메인 콘텐츠로 건너뛰기
버전: v2.8.1

Routing

Routing is a popular way to switch views in an application. This page offers some guidance around how to do that.

Vue

The recommended approach for routing in Vue is Hash Mode:

import { createRouter, createWebHashHistory } from "vue-router";

const router = createRouter({
history: createWebHashHistory(),
routes: [
//...
],
});

Angular

The recommended approach for routing in Angular is HashLocationStrategy:

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

React

The recommended approach for routing in React is HashRouter:

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
);