Description
What version of React, ReactDOM/React Native, Redux, and React Redux are you using?
- React: 18.2.0
- ReactDOM/React Native: 18.2.0
- Redux: 5.0.0-beta.0
- Redux Toolkit: 2.0.0-beta.0
- React Redux: 8.0.7
What is the current behavior?
When upgrading from react-redux 8.0.5 to 8.0.7, along side of Redux Toolkit 2.0.0-beta.0 + Redux 5.0.0-beta.0, my application code throws an error when using an RTK Query hook:
Uncaught Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>
at useReduxContext (useReduxContext.js:24:11)
at useStore2 (useStore.js:17:9)
at useDispatch2 (useDispatch.js:14:19)
at useQuerySubscription (buildHooks.ts:689:24)
at useQuery (buildHooks.ts:964:42)
at RequireAuthentication (RequireAuthentication.tsx:34:7)
The application code is wrapped in a Provider and has been functioning normally for months with the Redux Toolkit alphas, and is also functioning normally with the just-released Redux Toolkit beta. It is only when I upgrade to react-redux 8.0.7 that the error is thrown. When I downgrade to react-redux 8.0.5, without modifying any other dependencies, the error is not thrown.
Interestingly, useSelector()
, which I would assume is accessing the same exact context from the provider, works fine. But useGet*Query()
from RTK Query throws. Final note, I am using Yarn PnP and Yarn Workspaces.
What is the expected behavior?
No error should be thrown, as the component is wrapped in a provider.
Which browser and OS are affected by this issue?
Chrome 113 on macOS Ventura
Did this work in previous versions of React Redux?
- Yes