Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs react store.subscribe setState警告_Reactjs_React Native_React Router_React Redux - Fatal编程技术网

Reactjs react store.subscribe setState警告

Reactjs react store.subscribe setState警告,reactjs,react-native,react-router,react-redux,Reactjs,React Native,React Router,React Redux,当存储数据更改时,我尝试更新状态。我订阅componentDidMount,取消订阅componentWillUnmount,如下所示: componentDidMount() { const { store } = this.context this.unsubscribe = store.subscribe(() => { this.setState({ skillsValue: store.getState().admin.userProfile.seeker.s

当存储数据更改时,我尝试更新状态。我订阅componentDidMount,取消订阅componentWillUnmount,如下所示:

componentDidMount() {   
const { store } = this.context
this.unsubscribe = store.subscribe(() => {      
this.setState({ 
skillsValue: store.getState().admin.userProfile.seeker.skillsValue || [],
...
componentWillUnmount()
{
this.unsubscribe
}
然而,我得到了这个警告


警告:设置状态(…):只能更新已安装或正在安装的组件。这通常意味着您在未安装的组件上调用了setState()。这是禁止操作。请检查xxxx组件的代码。

他们现在都在使用
react redux
。它可能会帮你清理这些东西。也许没有多少人关心这个问题,但我仍然希望有一个好的解决方案。不仅反应,而且还遇到了!