๐ซ
[...] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>
react-router-dom v6๋ถํฐ๋,
๊ทธ๋ฆฌ๊ณ <Routes>
์์์ผ๋ก๋ <Route>
๋ง ๊ฐ๋ฅํ๋ค. ๋ฐ๋ผ์ v6 ์ด์ ์ฒ๋ผ ์๋์ ๊ฐ์ด ์ฝ๋๋ฅผ ์์ฑํ๋ฉด ์๋ฌ๊ฐ ๋ฐ์ํ๋ ๊ฒ์ด๋ค.
import {
BrowserRouter as Router,
Routes,
Route,
Link
} from "react-router-dom";
function App() {
return (
<div className="App">
<Router>
<Routes>
<Route path="/">
<LandingPage />
</Route>
<Route path="/login">
<LoginPage />
</Route>
<Route path="/register">
<RegisterPage />
</Route>
</Routes>
</Router>
</div>
);
}
export default App;
<Routes>
์์์ผ๋ก๋ <Route>
๋ง ๊ฐ๋ฅํ๋ฐ <LandingPage />
, <LoginPage />
, <RegisterPage />
๊ฐ ์กด์ฌํ๊ธฐ ๋๋ฌธ์ ์๋ฌ๊ฐ ๋ฐ์ํ ๊ฒ์ด๋ค.
์๋์ ๊ฐ์ด ์์ ํด์ฃผ๋ฉด ๋๋ค.
import {
BrowserRouter as Router,
Routes,
Route,
Link
} from "react-router-dom";
function App() {
return (
<div className="App">
<Router>
<Routes>
<Route path="/" element={ <LandingPage /> } />
<Route path="/login" element={ <LoginPage /> } />
<Route path="/register" element={ <RegisterPage /> } />
</Routes>
</Router>
</div>
);
}
export default App;
์ ๋ง ๊ฐ์ฌํฉ๋๋ค!!!!!!!!!!!