purpose of <MatchRoute component
https://tanstack.com/router/v1/docs/framework/react/examples/kitchen-sink-react-query-file-based
in dahsboard.invoices.tsx
what is the purpose of this component
React Router Kitchen Sink React Query File Based Example | TanStack...
An example showing how to implement Kitchen Sink React Query File Based in React Router

2 Replies
foreign-sapphireOP•2y ago
Navigation | TanStack Router Docs
Everything is Relative
Believe it or not, every navigation within an app is relative, even if you aren't using explicit relative path syntax (../../somewhere). Any time a link is clicked or an imperative navigation call is made, you will always have an origin path and a destination path which means you are navigating from one route to another ...
robust-apricot•2y ago
The MatchRoute component can be though of as an IF STATEMENT of sorts, that lets you programmatically render something if all the checks pass.
This is the intended behaviour of the component.
In the screenshot above, the conditions would be,
- Route is
/dashboard/invoices/$invoiceId
- Path matches invoiceId=invoice.id
- Route is in the pending state (like when the loader is being called)
Based on your loader setup and timing this could affect when the conditions for if the route has been matched to render its children.
You can fully see it in action on the /dashboard/users page when navigating between users.