Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add react-router to routing.mdx #1755

Merged
merged 1 commit into from
Aug 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion website/docs/guides/routing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,24 @@ The recommended approach for routing in Angular is [HashLocationStrategy](https:

```ts
RouterModule.forRoot(routes, {useHash: true})
```
```

## React

The recommended approach for routing in React is [HashRouter](https://reactrouter.com/docs/en/v6/routers/hash-router):

```jsx
import { HashRouter } from "react-router-dom";

ReactDOM.render(
<HashRouter basename={'/'}>
{/* The rest of your app goes here */}
<Routes>
<Route path="/" element={<Page0/>} exact />
<Route path="/page1" element={<Page1/>} />
<Route path="/page2" element={<Page2/>} />
{/* more... */}
</Routes>
</HashRouter>,
root);
```