I think I know the answer to this question, but just to make sure:
I want the React component to call this.setState()
when a Redux state goes into a specific state (like state.dataLoaded === true
). Should I use it in some way subscribe
, or is it too low, and instead, should I use it connect
to match state with details? In this case, I assume that this would be acceptable:
componentWillReceiveProps(nextProps) {
if (nextProps.dataLoaded) {
this.setState({
dataSource: this.state.dataSource.cloneWithRows(nextProps.posts)
});
}
}
source
share