Skip to content

Commit e130293

Browse files
gaearonPavel Zhytko
authored and
Pavel Zhytko
committed
Document adding a router (facebook#3709)
1 parent fd3154b commit e130293

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/react-scripts/template/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ You can find the most recent version of this guide [here](https://github.com/fac
3434
- [Adding Bootstrap](#adding-bootstrap)
3535
- [Using a Custom Theme](#using-a-custom-theme)
3636
- [Adding Flow](#adding-flow)
37+
- [Adding a Router](#adding-a-router)
3738
- [Adding Custom Environment Variables](#adding-custom-environment-variables)
3839
- [Referencing Environment Variables in the HTML](#referencing-environment-variables-in-the-html)
3940
- [Adding Temporary Environment Variables In Your Shell](#adding-temporary-environment-variables-in-your-shell)
@@ -804,6 +805,26 @@ In the future we plan to integrate it into Create React App even more closely.
804805

805806
To learn more about Flow, check out [its documentation](https://flowtype.org/).
806807

808+
## Adding a Router
809+
810+
Create React App doesn't prescribe a specific routing solution, but [React Router](https://reacttraining.com/react-router/) is the most popular one.
811+
812+
To add it, run:
813+
814+
```sh
815+
npm install --save react-router react-router-dom
816+
```
817+
818+
Alternatively you may use `yarn`:
819+
820+
```sh
821+
yarn add react-router react-router-dom
822+
```
823+
824+
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.
825+
826+
Note that [you may need to configure your production server to support client-side routing](#serving-apps-with-client-side-routing) before deploying your app.
827+
807828
## Adding Custom Environment Variables
808829

809830
>Note: this feature is available with `[email protected]` and higher.

0 commit comments

Comments
 (0)