I'm covering app js with layout. I have the sidebar on the left and my pages on the right. But what I want is that the sidebar should not appear on the login page, how can I edit it?
CodePudding user response:
you can add a condition with pathname
to showing the component or not
something like this:
const router = useRouter():
return (
...
{router.pathname !== '/login' && <Sidebar path={router.route} />}
...
)
CodePudding user response:
If you have some pages that are protected and can be seen by logged in user than you would need Public and Protected Routes and you can show in your Public routes only
If this is not the case then solution mentioned by @kaveh karami is good