Created
June 26, 2018 22:24
-
-
Save whoisryosuke/d034d3eaa0556e86349fb2634788a7a1 to your computer and use it in GitHub Desktop.
ReactJS - NextJS - A HOC for wrapping NextJS pages in an authentication check. Checks for getInitialProps on the child component and runs it, so you still get SSR from the page. Also includes a user agent for Material UI.
anyone done this without getInialProps ? currently im using next 11 and i want to add auth to my app but so far i couldnt understand the logic around protected routes in next js
Thank a lot
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the help @Sergioamjr
I've tried both, but making props optional was the only one that worked! I guess
Partial
would go 1 level up so that props become optional.💪