react-route
tiny react router thats less opinionated than react-router
Last updated 5 years ago by mattmueller .
MIT · Original npm · Tarball · package.json
$ cnpm install react-route 
SYNC missed versions from official npm registry.

react-route

Simple, tiny router for React.

<div className = 'Home'>
  <Route path = '/'>
    <div>Index /</div>
  </Route>
  <Route path = '/about'>
    About me
  </Route>
  <Route path = '/user/:user'>
    <User />
    <Route path = '/user/amy'>
      Hi amy!
    </Route>
  </Route>
</div>

Features

  • Parameter support via props.params
  • Simple API for navigating pages
  • HTML5 History Support
  • No wrapping handlers
  • Nesting

Installation

npm install react-route

API

<Route path='...' />

Specify an express-style path. For a list of possibilities check out: https://github.com/pillarjs/path-to-regexp

Any child components will receive a params property based on the pathname and keys provided.

<p>
  Welcome user {this.props.params.user}
</p>

Route.go(path)

Navigate to path and re-render the routes.

onclick () {
  Route.go('/user/amy');
}

License

MIT

Current Tags

  • 1.0.3                                ...           latest (5 years ago)

4 Versions

  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 36
Last Day 1
Last Week 15
Last Month 77
Dependencies (3)
Dev Dependencies (1)

Copyright 2014 - 2017 © taobao.org |