How to correctly set up nested routes so that Breadcrumbs work?
I have the following structure:
_auth.contracts.tsx
_auth.contracts.lazy.tsx
_auth.contracts_.$contractId.tsx
_auth.contracts_.$contractId.lazy.tsx
In _auth.contracts_.$contractId.tsx, I added the suffix _ to prevent the "contracts" page from rendering instead of the "contractId" page. However, because of this, I'm not getting the "contracts" page in the matches.
After some manipulation in Breadcrumbs with useMatches, I managed to get the following array:
And in this array, "/_auth/contracts" is missing becouse of suffix _. Can you suggest how to properly set up nested routing? I don't want contractId to render within contracts.
2 Replies
evident-indigo•2y ago
You could do this.
Move all the UI and route configuration from
_auth.contracts.tsx to _auth.contracts.index.tsx, and just render an <Outlet /> at the former.extended-salmonOP•2y ago
Okay, thank you, I will try.