React.Outlet-like feature #973
-
I'm digging into Solara's approach to routing. I was wondering if there exists a component similar to React's Outlet. The goal is to integrate routes into a parent component, rather than globally. Use case: a main component with a permanent navbar (AppBar) and a routed body. Clicking on a navbar link renders the associated component in the body. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Hi @edan-bainglass! That's a good question. Solara already supports routing (docs), both based on automatic file discovery, or manual management. You can use routing together with the special I made a quick PyCafe example to illustrate the usage. Let me know if you have any further questions! |
Beta Was this translation helpful? Give feedback.
-
Thanks @iisakkirotko. That works well for my case. I was wondering, is there a clean way to define my app's root path? Running |
Beta Was this translation helpful? Give feedback.
-
How would I use context across routes? My app has 4 routes. I want to provide context to one of the routes. How can I do this? The usage of the |
Beta Was this translation helpful? Give feedback.
Hi @edan-bainglass! That's a good question.
Solara already supports routing (docs), both based on automatic file discovery, or manual management. You can use routing together with the special
Layout
component to wrap all the children (or all the children of some sub-route) with whatever structure you want.I made a quick PyCafe example to illustrate the usage.
Let me know if you have any further questions!