1.1.0 • Published 2 years ago
@shipyard-media/router v1.1.0
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
2 years ago
1.0.18
2 years ago
1.0.17
2 years ago
1.0.16
2 years ago
1.0.15
2 years ago
1.0.14
2 years ago
1.0.13
2 years ago
1.0.12
2 years ago
1.0.11
2 years ago
1.0.10
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago