score:0

i ended up creating a subroutes object and mapping around that to create new routes just below the first map. it should render its own route tag which is what i was going for. if anyone else has a different approach would be good to see it :)

const subroutes = [
    { path: `/blog/:id(\\d+)`, name: 'post', component: postpage },
    { path: `/projects/:id(\\d+)`, name: 'project', component: projectspage },
]
{routes.map(({ path, component }) => (          
   <route key={path} exact path={path}>
       {({ match }) => <component data={dataobject} imagepath={imagepath} in={match != null} />}
</route>
))}

{subroutes.map(({ path, component }) => (
  <route key={path} exact path={path}>
    {({ match }) => <component data={dataobject} imagepath={imagepath} in={match != null} />}
</route>
))}


Related Query

More Query from same tag