top | item 37464291

(no title)

fnky | 2 years ago

I've had the encountered same problem when trying to just get the request path in order to highlight the current active page link in a navigation. It's simply not possible with Server Components only.

I ended up having to wrap each nav link in a client-side component, meaning the active state is lost in no-JS land (but will still render the nav on the server). The provider just wraps the link to provide a class, which can then be used to identify, with CSS, which link is active.

I really don't understand how cookies and headers can be provided, but not even just the requested path.

discuss

order

No comments yet.