Skip to content

Commit 494d96f

Browse files
viankakrisnaJohnNilsson
authored andcommitted
Docs for react-router v4 basename feature (#2668)
* Docs for react-router v4 basename feature Fix facebook/create-react-app#2593 * Update README.md * Update README.md * Update README.md * Update README.md
1 parent 5eb7c73 commit 494d96f

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
@@ -1776,6 +1776,15 @@ To override this, specify the `homepage` in your `package.json`, for example:
17761776
17771777
This will let Create React App correctly infer the root path to use in the generated HTML file.
17781778
1779+
**Note**: If you are using `react-router@^4`, you can root `<Link>`s using the `basename` prop on any `<Router>`.<br>
1780+
More information [here](https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string).<br>
1781+
<br>
1782+
For example:
1783+
```js
1784+
<BrowserRouter basename="/calendar"/>
1785+
<Link to="/today"/> // renders <a href="/calendar/today">
1786+
```
1787+
17791788
#### Serving the Same Build from Different Paths
17801789
17811790
>Note: this feature is available with `react-scripts@0.9.0` and higher.

0 commit comments

Comments
 (0)