Advanced usage
@bmlt-enabled/svelte-spa-router is simple by design. A minimal router is easy to learn and implement, adds minimum overhead, and leaves more control in the hands of developers.
Thanks to the many features of Svelte and its ecosystem, @bmlt-enabled/svelte-spa-router can be used to achieve many more "advanced" results. These pages explain how to go beyond what the component offers out of the box:
- Route wrapping, including:
- Async routes and loading placeholders
- Route pre-conditions ("route guards")
- User data
- Static props
- Route events & callbacks —
onRouteEvent,onRouteLoading, andonRouteLoaded - Route transitions
- Nested routers
- Route groups
- Restore scroll position
For clean, path-based URLs and base-path support, see Path-based routing.