Answer the question
In order to leave comments, you need to log in
How to prevent access to certain pages in NextJs if the user is not authorized?
I'm new to nextJs, but I don't understand at all how to make it so that if the user is not logged in, then he can conditionally visit '/' and '/auth' , but cannot visit the others, for example '/home' , ' /news' and so on.
If in a normal react I did this using Switch,Redirect , then here I can do it if the user ends up with only 1 page, but I don’t know to have access to several pages
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question