Skip to content

emanuelefavero/nextjs-protected-route

Repository files navigation

Next.js Protected Routes

This is a simple example of how to protect routes in Next.js using a custom ProtectedRoute.tsx component.

Note: You could also use getInitialProps or getServerSideProps to protect routes

Live Demo

Screenshot

screenshot

Getting Started

  • Clone the repo and cd into the directory

  • Install dependencies

npm i
  • Run the app
npm run dev

License