Best practices for creating a sidebar on ssr
Answered
Dwarf Crocodile posted this in #help-forum
Dwarf CrocodileOP
Do you all have any best practices for creating a sidebar on ssr where you can put the sidebar in the layout and set the selected item from the page? I used contexts in pages to achieve this but they're not available on the server
Answered by DirtyCajunRice | AppDir
so you wrap just the text part in a client component that uses usePath to decerrn whether the css for highlighting is added
10 Replies
explain more about what is being selected.
Dwarf CrocodileOP
just one of the items in the list like thhis example
nothing spectacular
is that not just navigation…
why arent you just using links
those should all be pages
Dwarf CrocodileOP
Yes it's just navigation but the design requires to have some highlight of which page you are on
Those are all links
@Dwarf Crocodile Yes it's just navigation but the design requires to have some highlight of which page you are on
so you wrap just the text part in a client component that uses usePath to decerrn whether the css for highlighting is added
Answer
Dwarf CrocodileOP
Oh i hadn't thought of that, thank you