#I am getting white blank screen as soon as I uncomment "const dispatch=useDispatch();"

3 messages · Page 1 of 1 (latest)

royal bridge
#

I am not using dispatch at all anywhere else in my code but as soon as I comment back

const dispatch=useDispatch();

I get blank screen with multiple errors saying "useReduxContext.js:24 Uncaught Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>" but I am already importing like this

import {useDispatch} from "react-redux";

Please help me out

cerulean warren
steady dome
# royal bridge I am not using dispatch at all anywhere else in my code but as soon as I comment...

It sounds like you are having difficulty with the useDispatch hook from the react-redux library. This is likely caused by an incorrect version of react-redux being used, or an incorrect setup of the react-redux Provider component. To begin troubleshooting, you should check the version of react-redux you are using, and make sure that it is compatible with the version of React you are using. You should also make sure that the Provider component is wrapping the component where you are using the useDispatch hook. If this does not solve the issue, you should contact the react-redux team for further assistance.