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

This commit is contained in:
Maicarons J
2022-08-16 21:15:41 +10:00
committed by GitHub
parent 24c45ee488
commit 1e8ab4b2c1
+21 -1
View File
@@ -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);
```