You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
right now when i try to provide redux in my application i get an error like below.
// in my nextjs layout.tsx fileimport{Provider}from"react-redux";import{PropsWithChildren}from"react";importstorefrom"~/store/store";exportdefaultfunctionRoot({children} : PropsWithChildren){return(<html><body><Providerstore={store}>{children}</Provider></body></html>)}
the error:
Steps to Reproduce
You can recreate it as I mentioned above.
What is the expected behavior?
Redux should provide a special provider for Nextjs or client/server components
How did i fix it?
I created a provider under the store and used the phrase "use client" here
// ~/store/provider.tsx"use client";import{Provider}from"react-redux";import{PropsWithChildren}from"react";importstorefrom"./store";exportdefaultfunctionReduxProvider({ children }: PropsWithChildren){return<Providerstore={store}>{children}</Provider>;}
This should be solved in v8.1.2 - to an extent: Importing something from react-redux in a RSC file should now not throw an error any more, but you still will not be able to use the Provider or any hooks in a RSC.
Redux just has no strategy for RSC, as RSC renders might be shared between multiple users and are generally stateless.
What is the current behavior?
right now when i try to provide redux in my application i get an error like below.
the error:
Steps to Reproduce
You can recreate it as I mentioned above.
What is the expected behavior?
Redux should provide a special provider for Nextjs or client/server components
How did i fix it?
I created a provider under the store and used the phrase
"use client"
herein my layout
Environment Details
My dependencies on
package.json
fileThe text was updated successfully, but these errors were encountered: