RTK Query: Provider with a context instance #2123
-
I was migrating some code over from react-toolkit to RTK Query. I got this error:
After some investigating I figured out that my Provider is also supplying a context instance:
which explains the error. Removing the context prop eliminated the error. Is there a way to use a context instance with RTK Query? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Yes, by using const createApi = buildCreateApi(
coreModule(),
reactHooksModule({useSelector, useDispatch, useStore})
) |
Beta Was this translation helpful? Give feedback.
-
Out of curiosity, why are you using a custom context instance with React-Redux? |
Beta Was this translation helpful? Give feedback.
Yes, by using
buildCreateApi
and putting your context-bound hooks in there: