Skip to content

Question about "children" property #165

@doki97

Description

@doki97

Sorry if this may be a dumb or confusing question but i am checking out your router, migrating from the file-based routify router. I stumbled accross the "children" property inside the RouteConfig type. My assumption was that i can declare nested routes now that will be rendered through Sveltes children prop as a snippet, with the Layout around it.

e.g.

// routes.ts
// --- Main App Layout (all routes below are children of _module.svelte) ---
    {
        path: '/',
        component: MainLayout, // This contains components like a side- and navbar
        children: [
            { component: PageIndex },
             // ... further slotted routes
// _module.svelte --> MainLayout
<Navbar />
<div>
	{@render children?.()} // render slotted component here
</div>

Now my assumption would be that the nested child route with the PageIndex component would be injected into the parent MainLayout as a children prop, but that is not the case.
Am i missing something or what exactly does the "children" property do then ?
Is this Layout Style only possible by nesting multiple Routers into each other ?

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions