yarn add react-router-dom
/* App.tsx */
import { BrowserRouter, Routes, Route } from "react-router-dom";
import "./App.css";
import StartPage from "@pages/StartPage";
import SearchPage from "@pages/SearchPage";
import ResultPage from "@pages/ResultPage";
function App() {
return (
<div className="App">
<BrowserRouter>
<Routes>
<Route path="/" element={<StartPage />}></Route>
<Route path="/search" element={<SearchPage />}></Route>
<Route path="/result" element={<ResultPage />}></Route>
</Routes>
</BrowserRouter>
</div>
);
}
export default App;
path
에는 원하는 경로를, element
에는 띄우고자 하는 페이지를 넣어준다.