useDispatch() Error: Could not find react-redux context value; please ensure the component is wrapped in a

前端 未结 3 874
鱼传尺愫
鱼传尺愫 2021-02-18 13:54

I am trygin to use React-Redux library and I am getting the error on the title. I wrapped my components with Provider but I still get the error, only if I implement the useDispa

3条回答
  •  死守一世寂寞
    2021-02-18 14:34

    I did this on the same index.js file for a react-native app. This way you avoid having to export and add another file just for giving wrapping the App with the provider.

    const ReduxProvider = () => {
        return(
            
                
            
        )
    }
    
    AppRegistry.registerComponent(appName, () => ReduxProvider);
    

提交回复
热议问题