DEV Community

Kevin Le
Kevin Le

Posted on

3

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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay