Next.js Discord

Discord Forum

Get pathname

Answered
African Slender-snouted Crocodil… posted this in #help-forum
Open in Discord
Avatar
African Slender-snouted CrocodileOP
How do i get pathname in a server side component for a sidebar check
@Arinji
Answered by Arinji
So yea, you need to make a client component for the component you are making to show the current open window... And usePathname in there
View full answer

16 Replies

Avatar
Hola
But basically, not possible
Remember how you went "Hoorah we can make a navbar purely server side"

I was waiting for when you would realize this
Avatar
So yea, you need to make a client component for the component you are making to show the current open window... And usePathname in there
Answer
Avatar
@African Slender-snouted Crocodile
Avatar
African Slender-snouted CrocodileOP
😭
Avatar
It's fine, all of us go through it at one point in our nextjs journey
Btw, client components aren't like deadly stuff
Feel free to use them whenever needed
They get prerendered on the server as well
Avatar
African Slender-snouted CrocodileOP
I know, Im just trying to expend my knowledge on server components because my next.js projects feels like React projects πŸ˜‚ πŸ˜‚
Avatar
Ah xD
But anyways yea, any other question?
If not mark an answer
Avatar
African Slender-snouted CrocodileOP
πŸ‘
Avatar
Awesome, have a wonderful day ahead! :)