mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
doc: add react-router to routing.mdx (#1755)
This commit is contained in:
@@ -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);
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user