Motivation
As features are added, the list of children parameters might grow too. It is better to move to a single "contextual" parameter.
Technical Details
Create the RouterContext and RouteContext types:
export type RouterContext {
state: any;
rs: RouteStatus;
}
export type RouteContext = RouterContext & {
rp?: Record<string, ParameterValue>;
}
Then work the Router and Route components to group the parameter values into a single object that is passed to the rendering of the children snippet. This single contextual parameter should be destructurable to allow for easy syntax:
<Router>
{#snippet children({ state, rs })}
...
<Route ...>
{#snippet children({ state, rs, rp })}
...
{/snippet}
</Route>
...
{/snippet}
</Router>
NOTE TO READERS: Yes, the state and rs values in the Router and child Route are the same thing, so in practice, you could just deconstruct for route parameters in the children snippet for Route components: {#snippet children({ rp })}.