adding-a-router.md 732 Bytes
Newer Older
1
2
---
id: adding-a-router
Kristofer Selbekk's avatar
Kristofer Selbekk committed
3
title: Adding A Router
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---

Create React App doesn't prescribe a specific routing solution, but [React Router](https://reacttraining.com/react-router/web/) is the most popular one.

To add it, run:

```sh
npm install --save react-router-dom
```

Alternatively you may use `yarn`:

```sh
yarn add react-router-dom
```

To try it, delete all the code in `src/App.js` and replace it with any of the examples on its website. The [Basic Example](https://reacttraining.com/react-router/web/example/basic) is a good place to get started.

22
Note that [you may need to configure your production server to support client-side routing](/docs/deployments#serving-apps-with-client-side-routing) before deploying your app.