0.2.1 • Published 2 years ago

rocky7-router v0.2.1

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

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

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

0.2.1

2 years ago

0.2.0

2 years ago

0.1.100

2 years ago

0.1.99

2 years ago

0.0.33

2 years ago

0.0.32

2 years ago

0.0.31

2 years ago

0.0.30

2 years ago

0.0.28

2 years ago