Svelte Store Router

screenshot of Svelte Store Router
svelte

Store-based router for Svelte

Overview:

The store-based router for Svelte is a routing solution that takes a different approach by considering routing as just another global state. It suggests that History API changes are optional side effects of this state. This router allows for easy manipulation of different parts of the state, such as the path, query, and fragment, individually. It also offers automatic parsing of query and fragment parameters, configurable delay of History changing, conversion of query and fragment string values to JavaScript types, and cleaning of empty values. Additionally, it provides support for handling navigation without reloading the page and works well with server-side rendering.

Features:

  • Just another global state: Routing is treated as another global state in the application.
  • No restrictions on state application: The router does not impose any restrictions on how the routing state is applied to the application.
  • Manipulate different parts of the state separately: The router allows for easy manipulation of the path, query, and fragment individually.
  • Automatic parsing of query and fragment parameters: Query and fragment parameters are automatically parsed by the router.
  • Components for path matching and parameter extraction: The router provides components for path matching and extracting parameters using regexparam.
  • Configurable delay of History changing: The delay before History pushstate is called can be configured to prevent a large number of items from appearing in the History state.
  • Conversion of query and fragment string values to JavaScript types: Query and fragment string values can be converted to their respective JavaScript types.
  • Cleaning of query and fragment from empty values: The router cleans query and fragment from empty values like null, undefined, and empty strings.
  • Automatic handling of <a> navigation: Navigation using <a> tags can be handled automatically, allowing for updating the route state without reloading the page.
  • Works well with server-side rendering: The router is compatible with server-side rendering.
svelte
Svelte

Svelte is a modern front-end framework that compiles your code at build time, resulting in smaller and faster applications. It uses a reactive approach to update the DOM, allowing for high performance and a smoother user experience.