v3.2.0 GitHub

Nested routes

Working with nested routes is pretty similar to Vue Router.

First, you should define children property in route:

        path: '/',
        component: Index,
        name: 'Index',
        children: [
                path: 'nested',
                component: Nested,
                name: 'Nested'

Then, add into Index component RouterOutlet:

// Index.svelte
import { RouterOutlet } from '@easyroute/svelte'

<RouterOutlet />

Now you will see both rendered components on the screen.


Svelte Easyroute ecosystem uses Svelte context API. Context name is easyrouteContext. Never redefine it in your components!