is there usePathname similarity on server component?
Unanswered
gref9730 posted this in #help-forum
gref9730OP
I have a page where I need to do post request based on pathname .. I basically want to take first pathname value after port and put taht in body of a fetch request.. do I have to switch this component to client to do so or is there a way on api endpoint to determine from which specific url the request came from?
2 Replies
Plott Hound
hey since usePathname is a client hook and there is no built in way to get the pathname in RSC there is only this 'workaround' curently:
https://github.com/vercel/next.js/issues/43704#issuecomment-1411186664
https://github.com/vercel/next.js/issues/43704#issuecomment-1411186664
gref9730OP
I see thanks