#Is there a way to create responsive nav bar as RSC that updates its active tab when clicked?
10 messages · Page 1 of 1 (latest)
Isn't clicking something only done the UI side? In that case I don't think this would be possible
Not clicking but onClick is client side only but my navbar has three Link items that navigates to different routes upon clicking. How can I update this navbar when route changes server side?
You can't do this entirely through RSC. Since active tabs by their nature are based on the state on the client side, the actual active tabs would have to be within a client component.
did u ever figure this out?
Nope. I made it client component and render it in layout.
You can access route params from server components, both in layouts and pages. You can pass this params to your components there. So when you click the link, this component gets rerendered on the server
Then I need to move the navbar server component from layout to each page components. Because Layout does not render every time when navigating.