Declarative routing for React.
React Router keeps your UI in sync with the URL. Make the URL your first thought, not an after-thought.
Using npm:
$ npm install --save react-router@next
Then with a module bundler like webpack, use as you would anything else:
// using an ES6 transpiler, like babel
import { BrowserRouter, Match, Link } from 'react-router'
// not using an ES6 transpiler
var BrowserRouter = require('react-router').BrowserRouter
var Match = require('react-router').Match
var Link = require('react-router').Link
The UMD build is also available on unpkg:
<script src="https://unpkg.com/react-router@next/umd/react-router.min.js"></script>
You can find the library on window.ReactRouter
.
Please read our docs here.
Thanks to our sponsors for supporting the development of React Router.
Also, thanks to BrowserStack for providing the infrastructure that allows us to run our build in real browsers.