Module suika-router - v1.5.4

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

Index

Classes

Interfaces

Type Aliases

Functions