0.2.1 • Published 12 months ago

rocky7-router v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months 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

12 months ago

0.2.0

12 months ago

0.1.100

1 year ago

0.1.99

1 year ago

0.0.33

1 year ago

0.0.32

1 year ago

0.0.31

1 year ago

0.0.30

1 year ago

0.0.28

1 year ago