It turns out that I was able to solve this problem by inserting componentWillUpdate into the Groups component, that is, whenever the group component is updated, it runs the loadGroupsData function:
componentWillUpdate() { this.loadGroupsData(); }
..., in which the loadGroupsData function checks for any differences, and if present, it loads:
loadGroupsData() { api.getUserGroups(this.state.userId, (data) => { data.forEach((group, index) => { group.groupname = group.groupname; }); if (this.state.dataSource._cachedRowCount === undefined || this.state.dataSource._cachedRowCount !== data.length) { this.setState({ usersGroups: data.map(data => data.groupname), dataSource: this.state.dataSource.cloneWithRows(data), loaded: true, }); } });}
S. McGraw
source share