DEV Community

Kevin Le
Kevin Le

Posted on

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

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?

Top comments (0)