Skip to content

Commit cf39747

Browse files
viankakrisnakasperpeulen
authored andcommitted
Docs for react-router v4 basename feature (facebook#2668)
* Docs for react-router v4 basename feature Fix facebook#2593 * Update README.md * Update README.md * Update README.md * Update README.md
1 parent 31695a3 commit cf39747

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/react-scripts/template/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -1772,6 +1772,15 @@ To override this, specify the `homepage` in your `package.json`, for example:
17721772
17731773
This will let Create React App correctly infer the root path to use in the generated HTML file.
17741774
1775+
**Note**: If you are using `react-router@^4`, you can root `<Link>`s using the `basename` prop on any `<Router>`.<br>
1776+
More information [here](https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string).<br>
1777+
<br>
1778+
For example:
1779+
```js
1780+
<BrowserRouter basename="/calendar"/>
1781+
<Link to="/today"/> // renders <a href="/calendar/today">
1782+
```
1783+
17751784
#### Serving the Same Build from Different Paths
17761785
17771786
>Note: this feature is available with `react-scripts@0.9.0` and higher.

0 commit comments

Comments
 (0)