Skip to content

Commit

Permalink
Merge pull request #9955 from marmelab/update-routing-documentation-v4
Browse files Browse the repository at this point in the history
Update Routing Documentation Regarding `basename`
  • Loading branch information
fzaninotto committed Jun 26, 2024
2 parents 9f007a3 + c76df17 commit 4e7c006
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/Routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ const App = () => (

React-admin links are absolute (e.g. `/posts/123/show`). If you serve your admin from a sub path (e.g. `/admin`), react-admin works seamlessly as it only appends a hash (URLs will look like `/admin#/posts/123/show`).

However, if you serve your admin from a sub path AND use another Router (like `BrowserRouter` for instance), you need to set the `<Admin basename>` prop, so that react-admin routes include the basename in all links (e.g. `/admin/posts/123/show`).
However, if you serve your admin from a sub path AND use another Router (like `BrowserRouter` for instance), you need to set the `<BrowserRouter basename>` prop, so that react-admin routes include the basename in all links (e.g. `/admin/posts/123/show`).

```jsx
import { Admin, Resource } from 'react-admin';

const App = () => (
<BrowserRouter>
<Admin basename="/admin" dataProvider={...}>
<BrowserRouter basename="/admin">
<Admin dataProvider={...}>
<Resource name="posts" />
</Admin>
</BrowserRouter>
Expand Down

0 comments on commit 4e7c006

Please sign in to comment.