Kullanıyorum react-router-dom
v6. İstiyorum ben Login
sayfa olmadan işlenecek Sidebar
ve Topbar
bileşenler. Bunu yapmak için nasıl?
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>
);
}
Giriş sayfamın içinde işlenmesini istemiyorum. MainContent
ama tüm sayfayı almadan Sidebar
ve Topbar
.
Hareket etmeye çalıştım Routes
yukarı ve giriş yapın route
kenar çubuğunun üstünde ancak bir hata var Error: [Sidebar] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>