react-wayfarer

1.0.0 • Public • Published

react-wayfarer

package version package downloads standard-readme compliant package license make a pull request

A naive little router build with wayfarer (492 bytes gzipped)

Table of Contents

Install

This project uses node and npm.

$ npm install react-wayfarer
# OR 
$ yarn add react-wayfarer

Usage

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);
 

Contribute

  1. Fork it and create your feature branch: git checkout -b my-new-feature
  2. Commit your changes: git commit -am "Add some feature"
  3. Push to the branch: git push origin my-new-feature
  4. Submit a pull request

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i react-wayfarer

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

7.8 kB

Total Files

11

Last publish

Collaborators

  • tiaanduplessis