I don't know what initialReduxState is #65773
-
SummaryI have this error Additional informationlayout.js
import { Provider } from 'react-redux'
import { useStore } from '../store'
import Layout from '../components/Layout'
import '../globals.css'
function MyApp({ Component, pageProps }) {
const store = useStore(pageProps.initialReduxState)
return (
<Provider store={store}>
<Layout>
<Component {...pageProps} />
</Layout>
</Provider>
)
}
export default MyApp
store.js
export function useStore(initialState) {
const store = useMemo(() => initializeStore(initialState), [initialState])
return store
} ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, You are mixing up concepts here. You are however, showing a Are you following a tutorial or something like that? If you used create-next-app, you might have accidentally chose to use App Router, over Pages Router, when it asked you which one you'd want to use. |
Beta Was this translation helpful? Give feedback.
Hi,
You are mixing up concepts here.
{Component, pageProps}
, where some of the props passed to the customApp
component, that lived in _app, in Pages Router.You are however, showing a
layout.js
file, which indicates that you are in the App Router.Are you following a tutorial or something like that? If you used create-next-app, you might have accidentally chose to use App Router, over Pages Router, when it asked you which one you'd want to use.