T
TanStack8mo ago
absent-sapphire

useActive for nested children

Hi everyone! I'm using TanStack Router, file based routing for the 1st time and have a question. I have a structure that looks like in the image (simplified example). So I access the admin part at /moduleone/admin (ADMIN menu entry) and the client part at /moduleone (CLIENT menu entry). This is all as intended, the thing is that I want to use activeProps to show which menu link is selected. And /moduleone (CLIENT) shows as active just fine, but when I navigate to moduleone/admin (ADMIN) it also shows me /moduleone as active. Setting activeOptions: exact fixes it but I also have a sidebar menu with some children routes, such as /moduleone/admin/example, and I would still like to see the "main" /moduleone/admin as active too, which is not the case if I activeOptions: exact is true. Idk if this explains it well enough but if any1 has any ideas how/if it's possible to use activeProps for this scenario, any hints would be appreciated.
No description
2 Replies
absent-sapphire
absent-sapphireOP8mo ago
Bump. Any ideas?
stormy-gold
stormy-gold8mo ago
can you please provide a complete minimal example (e.g. by forking one of the existing stackblitz examples)?

Did you find this page helpful?