reduxjs / redux-toolkit

The official, opinionated, batteries-included toolset for efficient Redux development
https://redux-toolkit.js.org
MIT License
10.74k stars 1.18k forks source link

Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>. Though I have wrapped <Provider> in my RootLayout component. #3437

Closed hozaifa4you closed 1 year ago

hozaifa4you commented 1 year ago

Hope someone will help me to solve the problem.

I am facing a problem in nextjs13. I am facing the problem with any routes. I also not facing the problem with my main page /app/page.tsx but with others which I have like /app/memories/create /app/memories/update.

Error in the terminal or Error:

- error node_modules\react-redux\lib\hooks\useReduxContext.js (30:0) @ useReduxContext
- error Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>
    at UpdateMemory (./app/memories/update/page.tsx:14:83)
null

You can see it in my repo: https://github.com/yousuf4you/memory-share.git

In the terminal: redux error

/package.json : redux error package

file paths: redux error file path

phryneas commented 1 year ago

Your repo is private. Is your application wrapped in the React-Redux Provider?

(also, usage questions like this are usually not a case for the issue tracker, especially not in the wrong repository - this is redux-toolkit, not react-redux)

hozaifa4you commented 1 year ago

Sorry, Sir, I made it public.

phryneas commented 1 year ago

That component is wrapped in your ReduxProvider component. Add that in your app/layout.tsx. It's also not wrapped in your Provider component, which also uses a Redux Provider. Either would work, but you actually have to use those components, not only create them and not use them then.