#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)

tepid dragon
#

#1007476603422527558

low pond
#

Isn't clicking something only done the UI side? In that case I don't think this would be possible

tepid dragon
#

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?

high reef
tepid dragon
unkempt quest
#

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

tepid dragon
#

Then I need to move the navbar server component from layout to each page components. Because Layout does not render every time when navigating.

unkempt quest
#

I think you can use templates for that

#

They behave like layouts except they do rerender on navigation