pagify-it
Install
yarn add page pagify-it
Usage
; const Home = <div>HOME</div>;const About = <div>ABOUT <Link to="/">HOME</Link></div>;const Post = <div>POST # propsctxparamsid</div>; const routes = '/': Home '/about': About '/post/:id': Post <div>404</div>; const App = <Router ... routes />;// props: routes, opts (optional), base (optional), onChange(path, ctx) (optional) // to display a link <a />, it accepts a base prop (optional) as well<Link to="/posts" /> // to navigate to a certain path; // to redirect to a certain path; // context: each rendered route will have a `ctx` prop with some routing metadata
Docs
See Page.js.
Example
Note: Routing with hashes is used in the example for hosting on GitHub pages, in a typical app you won't need it.