I tried to update the state when store data changed. I subscribe on componentDidMount and unsubscribe on componentWillUnmount as below:
componentDidMount() {
const { store } = this.context
this.unsubscribe = store.subscribe(() => {
this.setState({
skillsValue: store.getState().admin.userProfile.seeker.skillsValue || [],
...
componentWillUnmount()
{
this.unsubscribe
}
However, I got this warning.
Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the xxxx component.