Unverified Commit bb718307 authored by Dan Abramov's avatar Dan Abramov Committed by GitHub
Browse files

Document adding a router (#3709)

parent 8cae659e
3 merge requests!12191Lim.Pisey.168:/Identified - We are currently investigating reports of missing build logs. The issue has been identified and a resolution is in progress. We will provide a further update when available.Mar 21, 09:02 UTC,!12853brikk,!5717Automatically extract project file structure from build bundle file
Showing with 21 additions and 0 deletions
+21 -0
......@@ -34,6 +34,7 @@ You can find the most recent version of this guide [here](https://github.com/fac
- [Adding Bootstrap](#adding-bootstrap)
- [Using a Custom Theme](#using-a-custom-theme)
- [Adding Flow](#adding-flow)
- [Adding a Router](#adding-a-router)
- [Adding Custom Environment Variables](#adding-custom-environment-variables)
- [Referencing Environment Variables in the HTML](#referencing-environment-variables-in-the-html)
- [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.
To learn more about Flow, check out [its documentation](https://flowtype.org/).
## Adding a Router
Create React App doesn't prescribe a specific routing solution, but [React Router](https://reacttraining.com/react-router/) is the most popular one.
To add it, run:
```sh
npm install --save react-router react-router-dom
```
Alternatively you may use `yarn`:
```sh
yarn add react-router 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.
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.
## Adding Custom Environment Variables
>Note: this feature is available with `react-scripts@0.2.3` and higher.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment