UNPKG

1.38 kBMarkdownView Raw
1# react-router
2
3Declarative routing for [React](https://facebook.github.io/react).
4
5## Installation
6
7Using [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
13Then with a module bundler like [webpack](https://webpack.github.io/), use as you would anything else:
14
15```js
16// using ES6 modules
17import { Router, Route, Switch } from "react-router";
18
19// using CommonJS modules
20var Router = require("react-router").Router;
21var Route = require("react-router").Route;
22var Switch = require("react-router").Switch;
23```
24
25The 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
31You can find the library on `window.ReactRouter`.
32
33## Issues
34
35If 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
39React Router is built and maintained by [React Training](https://reacttraining.com).