Routes Route and render={(props) => ()} using
I started an old course and the video shows that it has a rendering feature like this. I researched it and I think it is used with the Switch structure. Am I doing something wrong or what is the correct one?
<Routes>
{/* <Route
exact
path="/"
render={(props) => (
<ProductList
products={this.state.products}
addToCart={this.addToCart}
currentCategory={this.state.currentCategory}
info={productInfo}
/>
)}
/> */}
<Route exact path="/" element={<NotFound />} />
<Route element={<NotFound />} />
</Routes>
<ProductList
products={this.state.products}
addToCart={this.addToCart}
currentCategory={this.state.currentCategory}
info={productInfo}
/>``
When I use it this way, it brings the data to the home page without any problems, but when I type it in the comment line, the data does not come. The place where the data should come is empty1 Reply
TanStack | High Quality Open-Source Software for Web Developers
Headless, type-safe, powerful utilities for complex workflows like Data Management, Data Visualization, Charts, Tables, and UI Components.