export const routes = [
{ path: '/', element: <MainPage />},
{ path: '/posts', element: <Posts />},
{ path: '/posts/:postId', element: <PostIdPage />},
{ path: '/about', element: <About />},
{ path: '*', element: <h1>НЕТ ПУТИ</h1>},
]
<Routes>
{routes.map((r, index) => (
<Route key={r.path} path={r.path} element={r.element} />
))}
</Routes>