DEV Community

Discussion on: Authenticating things with cookies on Next.js

Collapse
 
jfranciscosousa profile image
Francisco Sousa

Ah sorry for the delay... not receiving dev notifications on my email for some reason.

You can read pageProps on _app.tsx (nextjs.org/docs/advanced-features/...) and add that to a global provider. You can read that with useContext on any componeny you want!

Do it on the render function though. If you add a custom getInitialProps on _app.tsx you disable all kinds of static optimizations!

Collapse
 
rumeetgoradia profile image
Rumeet Goradia

Thanks for the reply! Will definitely try this out :)