loading...

Server-side rendering such as Next.JS side effects with protecting routes

codeprototype profile image Kevin Le ・1 min read

Server-side rendering such as Next.JS brings many benefits, but when it comes to protecting routes, it brings its own wrinkles. For example, this approach by Tyler McGinnis won't work. Another example is simply checking for some property in localStorage won't work in getInitialProps, because localStorage is a property of the global window object which does not exist on NodeJS. If you know of others, would you mind sharing?

Discussion

pic
Editor guide