아랫분들도 설명해주셨다싶이 버전이 바뀌면서 쓰이는 용어가 바뀌었어요!
다만 올려주신부분들이 다 수업끝부분 완성본인것같아서..
저는 Home() About() Users()함수가 들어가야하는 초반 부분 수정본을 첨부해봅니다!
import React from "react";
import {
Route,
Routes,
BrowserRouter
} from "react-router-dom";
function Home() {
return <h2>Home</h2>;
}
function About() {
return <h2>About</h2>;
}
function Users() {
return <h2>Users</h2>;
}
function App() {
return (
<BrowserRouter>
<div>
{/* A <Switch> looks through its children <Route>s and
renders the first one that matches the current URL. */}
<Routes>
<Route path="/about" element={About()}>
<Route />
</Route>
<Route path="/users" element={Users()}>
<Route />
</Route>
<Route path="/" element={Home()}>
<Route />
</Route>
</Routes>
</div>
</BrowserRouter>
);
}
export default App;