Skip to content

Commit 665f5ed

Browse files
authored
Docs for react-router v4 basename feature
Fix facebook#2593
1 parent 76ad76e commit 665f5ed

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: packages/react-scripts/template/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -1784,6 +1784,15 @@ To override this, specify the `homepage` in your `package.json`, for example:
17841784
17851785
This will let Create React App correctly infer the root path to use in the generated HTML file.
17861786
1787+
If you are using react-router v4 for your client side routing, it supports `basename` config in the `BrowserRouter`. For example:
1788+
1789+
```js
1790+
<BrowserRouter basename="/calendar"/>
1791+
<Link to="/today"/> // renders <a href="/calendar/today">
1792+
```
1793+
1794+
So, all the `Link` component inside your app will navigate properly. Learn more [here](https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string)
1795+
17871796
#### Serving the Same Build from Different Paths
17881797
17891798
>Note: this feature is available with `react-scripts@0.9.0` and higher.

0 commit comments

Comments
 (0)