rocky7-router
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

rocky7 Router

Router for rocky7 inspired by react-router

Version License: MIT Build Status Badge size

npm: npm i rocky7-router
cdn: https://cdn.jsdelivr.net/npm/rocky7-router/+esm

Sponsors

You might want to try out grati.co, a no-code programming environment with emacs like extensibility.

Example

/** @jsx h **/

import { component, h, render } from "rocky7";
import { Link, Route, Switch, BrowserRouter } from "rocky7-router";

export const Layout = component<{}>("Layout", (props, {}) => {
  return (
    <BrowserRouter>
      <div>
        <ul>
          <li>
            <Link href="/">Home</Link>
          </li>
          <li>
            <Link href="/about">About</Link>
          </li>
        </ul>
        <Switch>
          <Route path="" component={Home} />
          <Route path="about" component={About} />
        </Switch>
      </div>
    </BrowserRouter>
  );
});
export const Home = component<{}>("Home", (props, {}) => {
  return <div>Home</div>;
});

export const About = component<{}>("About", (props, {}) => {
  return <div>About</div>;
});

render(<Layout />, document.body);

Ecosystem

Readme

Keywords

Package Sidebar

Install

npm i rocky7-router

Weekly Downloads

2

Version

0.2.1

License

MIT

Unpacked Size

17 kB

Total Files

10

Last publish

Collaborators

  • gratico