내가 사용하고 react-router-dom
v6. 내 Login
페이지를 렌더링할 것 없이 Sidebar
고 Topbar
구성 요소입니다. 어떻게 할까?
function App() {
return (
<Router>
<Container>
<Sidebar />
<Content>
<Topbar />
<MainContent>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/users" element={<UserList />} />
<Route path="/users/:id" element={<User />} />
<Route path="/newUser" element={<NewUser />} />
<Route path="/products" element={<ProductList />} />
<Route path="/products/:id" element={<Product />} />
<Route path="/newProduct" element={<NewProduct />} />
<Route path="/login" element={<Login />} />
</Routes>
</MainContent>
</Content>
</Container>
</Router>
);
}
나는 원하지 않는 나의 로그인 페이지를 렌더링하는 내 MainContent
그러나 전체없이 페이지 Sidebar
고 Topbar
.
I tried 이동 Routes
위고는 로그인 route
위의 사이드바이 Error: [Sidebar] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>