使用componentWillMount或componentWillUnMount时,<provider>不支持动态更改`store`

时间:2018-05-24 11:43:10

标签: javascript react-native redux react-redux redux-thunk

不支持动态更改//Handle TLS protocols System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls | System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12; var hub = new HubUtil("https://host/hubname"); await hub.StartIfNeededAsync(); hub.Invoke("checkin", "id", ""); 。您最有可能看到此错误,因为您已更新到Redux 2.x和React Redux 2.x,它们不再自动热重新加载Reducer

当我使用componentWillMount和componentWillUnMount时,我收到此错误

store

1 个答案:

答案 0 :(得分:1)

每次您的Component渲染时,都会创建一个新商店。 尝试在组件外部创建商店。

import resducers from './src/reducers/index';    
const store = createStore(resducers);

-

<Provider store={store}>