Routing in Solid
Edit this pageThe docs are based on Solid Router v0.10.x. To use this version, you need to have Solid v1.8.4 or later installed.
Solid Router is the universal router for SolidJS which works for rendering on the client or the server. It was inspired by and combines paradigms of React Router and the Ember Router.
A router provides a way to change a user's view based on the URL in the browser. This allows a "single-page" application to simulate a traditional multipage site. To use Solid Router, components called Routes that depend on the value of the URL (the "path") are specified, and the router handles the mechanism of swapping them in and out.
Setup
To get started with Solid Router, install it using your preferred package manager.
Configure the Routes
The Router
component is the root component of the router.
It is responsible for managing the URL and rendering the appropriate Route
based on the URL.
To configure your routes, import the Router
component and then start the application by rendering the router component.
This sets up the router that will match on the url and render the appropriate route.