A naive little router build with wayfarer (492 bytes gzipped)
This project uses node and npm.
$ npm install react-wayfarer
$ # OR
$ yarn add react-wayfarer
import React from "react";
import ReactDOM from "react-dom";
import Router from "react-wayfarer";
const PageOne = () => (
<h2>
Page 1 <a href="/fooper">go to</a>
</h2>
);
const PageTwo = props => <h2>Page 2 has the name {props.params.name}</h2>;
function App() {
return (
<Router>
<PageOne path="/" />
<PageTwo path="/:name" />
</Router>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
- Fork it and create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am "Add some feature"
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
MIT