Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Nov 16, 2022. It is now read-only.

zxlib/solid-router

Open more actions menu

Repository files navigation

Router for solid js

Installation

npm install @zxlib/solid-router

Usage

import { RouterProvider, Link, RouteSwitch, Route } from '@zxlib/solid-router';

export const App = () => {
  return (
    <RouterProvider>
      <div class="nav">
        <Link path="/">Index</Link>
        <Link path="/route1">Route1</Link>
        <Link path="/route2">Route2</Link>
        <Link path="/prefix4nested/">Sub Routes Index</Link>
      </div>
      <div class="content">
        <RouteSwitch>
          <Route path="/">Index content</Route>
          <Route path="/route1">Route1 Content</Route>
          <Route path="/route2">Route2 Content</Route>
          <Route fallback>No route</Route>
          <Route prefix path="/prefix4nested">
            <div>
              <div class="nav">
                <Link path="/">Sub Index</Link>
                <Link path="/route1">Sub Route1</Link>
                <Link path="/route2">Sub Route2</Link>
              </div>
            </div>
            <div class="nested content">
              <RouteSwitch>
                <Route path="/">Sub Index Content</Route>
                <Route path="/route1">Sub Route1 Content</Route>
                <Route path="/route2">Sub Route2 Content</Route>
                <Route fallback>No sub route</Route>
              </RouteSwitch>
            </div>
          </Route>
        </RouteSwitch>
      </div>
    </RouterProvider>
  );
};

There is some more examples at https://github.com/zxlib/solid-router-examples

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.