1.1.0 • Published 7 months ago

@shipyard-media/router v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Very Simple Router for React

For those that don't need the complexity of some of the existing solutions this is some basic routing.

Example

import React from "react";
import Router, { Route, Link, useRouter } from "@shipyard-media/router";

function LinkExample({ name }) {
  return (
    <>
      Hello {name}! <Link to="/say/bye/Todd">Say Goodbye!</Link>
    </>
  );
}

function HookExample({ word, name }) {
  const { active, push } = useRouter();
  return (
    <div>
      {word} {name}! The current page is {active}.
      <button onClick={() => push("/hello/Ted")}>Say hi to Ted</button>
    </div>
  );
}

export default function App() {
  return (
    <Router>
      <Route path="/hello/:name" component={LinkExample} />
      <Route path="/say/:word/:name" component={HookExample} />
      <Route path="/.*" component={() => <div>Catch All</div>} />
    </Router>
  );
}
1.1.0

7 months ago

1.0.18

12 months ago

1.0.17

12 months ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago