Skip to content

Commit 82c976b

Browse files
committed
add session provider setup
1 parent 1493ed2 commit 82c976b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/quick-start/nextjs.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,30 @@ Now we're ready to implement the signup/signin flow.
268268

269269
### 6. Implement Signup/Signin
270270

271+
Firstly, NextAuth and React Query require context providers to be set up. Let's add it to `/src/pages/_app.tsx`:
272+
273+
```tsx title='/src/pages/_app.tsx'
274+
import { type AppType } from "next/app";
275+
import { type Session } from "next-auth";
276+
import { SessionProvider } from "next-auth/react";
277+
278+
import "../styles/globals.css";
279+
280+
const MyApp: AppType<{ session: Session | null }> = ({
281+
Component,
282+
pageProps: { session, ...pageProps },
283+
}) => {
284+
return (
285+
<SessionProvider session={session}>
286+
<Component {...pageProps} />
287+
</SessionProvider>
288+
);
289+
};
290+
291+
export default MyApp;
292+
```
293+
294+
271295
Now let's implement the signup/signin pages. First, create a new page `/src/pages/signup.tsx`:
272296

273297
```tsx title='/src/pages/signup.tsx'

0 commit comments

Comments
 (0)