Files

48 lines
1.2 KiB
Plaintext

# Roteamento
O roteamento é uma maneira popular de alternar as telas de um aplicativo. Esta página oferece algumas orientações sobre como fazer isso.
## Vue
A abordagem recomendada para roteamento em Vue é o [Hash Mode](https://next.router.vuejs.org/guide/essentials/history-mode.html#hash-mode):
```js
import { createRouter, createWebHashHistory } from "vue-router";
const router = createRouter({
history: createWebHashHistory(),
routes: [
//...
],
});
```
## Angular
A abordagem recomendada para roteamento em Angular é [HashLocationStrategy](https://codecraft.tv/courses/angular/routing/routing-strategies#_hashlocationstrategy):
```ts
RouterModule.forRoot(routes, { useHash: true });
```
## React
A abordagem recomendada para roteamento em React é [HashRouter](https://reactrouter.com/en/main/router-components/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
);
```