dynamicznie definiuj trasy oddzielone na różnych stronach dla react
import React from "react"
import {products} from "../data/Products"
import {Route, Switch} from "react-router-dom"
import {DetailedProduct} from "../components/DetailedProduct"
export const ProductRoutesGenerator = () => {
return (
<Switch>
{products.map((product) => {
return (
<Route
exact
key={product.id}
path={product.productName}
>
<DetailedProduct {...product} />
</Route>
)
})}
<Switch>
)
}
Yucky Yak