Svelte: Router core part of Svelte framework?

Created on 6 May 2019  路  8Comments  路  Source: sveltejs/svelte

There are several implementations of router for Svelte framework, but a lot of them are not updated, or the functionality is weird.

Why not to include this basic feature to the framework?

Most helpful comment

You might want to try this: https://github.com/EmilTholin/svelte-routing

All 8 comments

I found duplicate issues, so I'll close this. Sorry :)

(To be maximally helpful to any future person who lands on this page... how about linking to the most relevant routing-related issues?)

FWIW, it doesn't seem likely that there will ever be a router built into the core of Svelte, which is a component library and not an application framework.

It's slightly more likely but also still I think not particularly likely that an official separate library will be published for routing. I've added a paragraph talking about Sapper to the 'what about routing' question on the FAQ. Sapper is probably as close to an official router as there's going to be. It's hard for something that's just a router to also be able to handle all of the other things like server-side rendering and rehydration that Sapper is able to handle.

The main issue where this was discussed previously was #172, which I also closed recently, because Sapper's is the only routing solution that Svelte is currently interested in blessing.

Would be great to have something like React-Router for Svelte...

I'm really trying to use it, but all routers are complex to implement Nested Routes....

something like

App.svelte

<Router>
    <Route path="/users" component={Users}/>
</Router>

and

Users.svelte

<Router>
    <Route path="/" exact component={Index}/>
    <Route path="/:id" exact component={Show}/>
    <Route path="/:id/edit" component={Edit}/>
</Router>

would be GREAT...

You might want to try this: https://github.com/EmilTholin/svelte-routing

You might want to try this: https://github.com/EmilTholin/svelte-routing
It works, thanks.

@bigjoevtrj on my side - working on component-based router to cover common cases (like leaving the page protection) as possible. https://github.com/qutran/swheel

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lnryan picture lnryan  路  3Comments

davidcallanan picture davidcallanan  路  3Comments

bestguy picture bestguy  路  3Comments

Rich-Harris picture Rich-Harris  路  3Comments

matt3224 picture matt3224  路  3Comments