Handling nested routes (migrating from react-router dom)
There is a way to describe nested routes in a component without importing them into the router.tsx (code-based way) here is tsx return
that is, the route declared in the router.tsx also has internal routers that have props based on the logic of the component, how to declare them correctly? It is also possible that nested routes may also have a similar structure
5 Replies
correct-apricot•14mo ago
Have you looked at the code-based examples?
You don't need to import the router into your router. In fact, its the opposite, since all your routes need to be created in a route-tree to be used in the created router.
You can only have a single router instance.
deep-jadeOP•14mo ago
Of course, I understand this logic, I just don’t fully understand how I can create routes for a tree if the components contain any props calculated in the parent route
correct-apricot•14mo ago
Components do not receive any props.
The parent set up is like this.
deep-jadeOP•14mo ago
Yep u created this tree and this work fine for me but one of package of my app contain this complecated logic, when some high lvl routes contain child routes (we migrated from react-router-dom) and it was created for minimizing duplicated code
if i understand correctly now i need deprecate this logic and create full route tree on router file
correct-apricot•14mo ago
Most likely yes.