@allain/surplus-router

Simple router for use with surplus

Usage no npm install needed!

<script type="module">
  import allainSurplusRouter from 'https://cdn.skypack.dev/@allain/surplus-router';
</script>

README

surplus-router

A simple router for use with Surplus

NPM

Install

npm install --save surplus-router

Example Usage

import * from Surplus from 'surplus'
import { Route } from 'surplus-router'

const view = <div>
    <Route path="/">
      <h1>Main Page</h1>
      <p><a href="#/test/123">Test 123</a></p>
      <p><a href="#/test/456">Test 456</a></p>
    </Route>
    <Route path="/test/:number">{({number}) => <p>Test {number}</p>}</Route>
  </div>;

document.body.appendChild(view); // add view to document

API

License

ISC © allain