Closed kahirokunn closed 3 years ago
@kahirokunn that's really not enough info for us to offer any help.
Do you actually have a Redux store setup and and a <Provider>
around your app, per the instructions?
In my environment, I don't get this error when using useDispatch inside a Provider. However, if I change useDispatch to use hooks obtained from RTK Query such as useGetPokemonByNameQuery in the sample, the error occurs.
I thought that maybe a different react-redux was installed, which resulted in a different context, but that was not the case.
$ ls node_modules/@rtk-incubator/rtk-query/
LICENSE README.md dist package.json src
I found the cause.
Using the debugger, I found that rtk-query imports react-redux/es. My babel was configured to import react-redux/lib. Therefore, it was referring to a different Context. This was a simple mistake. The following fix fixes it. I apologize for the inconvenience.
"plugins": [
["transform-imports", {
"react-redux": {
- "transform": "react-redux/lib",
- "transform": "react-redux/es",
"preventFullImport": true,
"skipDefaultConversion": true
}
}]
]
yup, something like that is usually the case :)
Could not find react-redux context value" inside react-redux. :cry: