1.5.4 • Published 2 years ago

suika-router v1.5.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

GitHub Workflow Status npm GitHub codecov

Suika Router (WIP) is a lightweight routing library for the Suika framework.

Installation

You can use suika-router as a package on npm

npm install suika@latest suika-router@latest

Documentation

Please follow the documentation at jonwatkins.github.io/suika/.

Usage

import { Component, mount, h } from "suika";
import { createRouter, RouterView, RouterLink } from "suika-router";

const root = document.getElementBytId("app");

class About extends Component {
  render() {
    return (
      <section class="content">
        <h1>About Us</h1>
      </section>
    )
  }
}

class Home extends Component {
  render() {
    return (
      <section class="content">
        <h1>Hello World</h1>
      </section>
    )
  }
}

const router = createRouter({
  mode: 'hash',
  routes: [
    { path: '/', component: Home },
    { path: '/about', component: About }
  ]
})

class App extends Component {
  render() {
    return (
      <div id="container">
        <ul class="navigation">
          <li><RouterLink to="/">Home</RouterLink></li>
          <li><RouterLink to="/about">About</RouterLink></li>
        </ul>
        <RouterView router={router}>
      </div>
    );
  }
}

mount(App, root);

License

MIT

Copyright (c) 2023-present, Jon Watkins

1.5.4

2 years ago

1.5.3

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.0.0

2 years ago