1 | # react-router
|
2 |
|
3 | Declarative routing for [React](https://facebook.github.io/react).
|
4 |
|
5 | ## Installation
|
6 |
|
7 | Using [npm](https://www.npmjs.com/):
|
8 |
|
9 | $ npm install --save react-router
|
10 |
|
11 | **Note:** This package provides the core routing functionality for React Router, but you might not want to install it directly. If you are writing an application that will run in the browser, you should instead install `react-router-dom`. Similarly, if you are writing a React Native application, you should instead install `react-router-native`. Both of those will install `react-router` as a dependency.
|
12 |
|
13 | Then with a module bundler like [webpack](https://webpack.github.io/), use as you would anything else:
|
14 |
|
15 | ```js
|
16 | // using ES6 modules
|
17 | import { Router, Route, Switch } from "react-router";
|
18 |
|
19 | // using CommonJS modules
|
20 | var Router = require("react-router").Router;
|
21 | var Route = require("react-router").Route;
|
22 | var Switch = require("react-router").Switch;
|
23 | ```
|
24 |
|
25 | The UMD build is also available on [unpkg](https://unpkg.com):
|
26 |
|
27 | ```html
|
28 | <script src="https://unpkg.com/react-router/umd/react-router.min.js"></script>
|
29 | ```
|
30 |
|
31 | You can find the library on `window.ReactRouter`.
|
32 |
|
33 | ## Issues
|
34 |
|
35 | If you find a bug, please file an issue on [our issue tracker on GitHub](https://github.com/ReactTraining/react-router/issues).
|
36 |
|
37 | ## Credits
|
38 |
|
39 | React Router is built and maintained by [React Training](https://reacttraining.com).
|