We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is your feature request related to a problem? Please describe. Plugin has no support for optional path parameters.
Describe alternatives you've considered Svelte navigator could drop hardcoded path parsing and make use of one of most used packages: https://www.npmjs.com/package/path-to-regexp https://www.npmjs.com/package/regexparam (a lightweight solution)
The text was updated successfully, but these errors were encountered:
That would be a huge improvement for svelte-navigator!
svelte-navigator
I would like to use the following syntax that is common in other frameworks like Vue:
path="/bar/foo/:id?"
Sorry, something went wrong.
That will make a lot of sense
You can achieve this in a complicated way by nesting routes. This should only be used as a workaround in my opinion.
App.svelte
<script> import { Router, Route } from "svelte-navigator"; </script> <Router> <Route path="/route/:requiredParam/*" let:params={params1}> <Route path="/optionalRoute/:optionalParam" let:params={params2}> <RouteComponent requiredParam={params1.requiredParam} optionalParam={params2.optionalParam}></RouteComponent> </Route> <Route path="/"> <RouteComponent requiredParam={params1.requiredParam}></RouteComponent> </Route> </Route> </Router>
RouteComponent.svelte
<script> export let requiredParam; export let optionalParam= null; </script>
No branches or pull requests
Is your feature request related to a problem? Please describe.
Plugin has no support for optional path parameters.
Describe alternatives you've considered
Svelte navigator could drop hardcoded path parsing and make use of one of most used packages:
https://www.npmjs.com/package/path-to-regexp
https://www.npmjs.com/package/regexparam (a lightweight solution)
The text was updated successfully, but these errors were encountered: