You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For nested routes to be fully supported, we'll need a component for each UI library, but we can provide primitives to make implementation easy and share the common logic between them.
getMatchedRoutes
This returns an array of Route objects, ordered parent-first.
Its result is injected before each page starts rendering.
The Route component can use this to know if it should render.
renderRoute
Given a Route object, it will load its route props and route module.
Then the route's layout (see [RFC] Layout modules #70) has its render method called, but with options.nested set to true (which signals to the layout that it should produce a result supported by its associated UI library, rather than plain HTML).
So the expected flow goes like this:
developer uses Route component specific to UI library of choice
component checks if any routes returned by getMatchedRoutes have a route pattern identical to its own
component calls renderRoute (if it finds a matching route) and does whatever with the result
Note that nested routes still need to be declared within the routes module, because that's where the route props, module, layout, and more are defined. That declaration is also used when pre-rendering and (eventually) bundling.
What's so great about nested routes?
Nested routes let you tell Saus that certain route props don't need to delay rendering until a certain point in the component tree. This means you can stream HTML to the browser before all data is loaded, which can vastly improve TTFP (time to first paint) and therefore make your site feel faster.
The text was updated successfully, but these errors were encountered:
For nested routes to be fully supported, we'll need a component for each UI library, but we can provide primitives to make implementation easy and share the common logic between them.
getMatchedRoutes
This returns an array of
Route
objects, ordered parent-first.Its result is injected before each page starts rendering.
The
Route
component can use this to know if it should render.renderRoute
Given a
Route
object, it will load its route props and route module.Then the route's layout (see [RFC] Layout modules #70) has its
render
method called, but withoptions.nested
set to true (which signals to the layout that it should produce a result supported by its associated UI library, rather than plain HTML).So the expected flow goes like this:
Route
component specific to UI library of choicegetMatchedRoutes
have a route pattern identical to its ownrenderRoute
(if it finds a matching route) and does whatever with the resultNote that nested routes still need to be declared within the routes module, because that's where the route props, module, layout, and more are defined. That declaration is also used when pre-rendering and (eventually) bundling.
What's so great about nested routes?
Nested routes let you tell Saus that certain route props don't need to delay rendering until a certain point in the component tree. This means you can stream HTML to the browser before all data is loaded, which can vastly improve TTFP (time to first paint) and therefore make your site feel faster.
The text was updated successfully, but these errors were encountered: