Next.js Discord

Discord Forum

Providers with the new app directory

European pilchard posted this in #help-forum
Open in Discord
European pilchardOP
If i wanted to do something such as wrapping my application in a provider with pages directory, i would have something like

export default function App({ Component, pageProps: { session, ...pageProps }, }: MyAppProps) { return ( <SessionProvider session={session}> <Component {...pageProps} /> </SessionProvider> ); }

in pages/_app.tsx

How would I do this when using only the app directory?

1 Reply

European sprat
the same way except you'd put the providers component in the root layout file