Skip to content

tiaanduplessis/react-wayfarer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A naive little router build with wayfarer

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published