score:1

you can try to use render props to the route component:

<switch>
  {this.props.admin.map((item, index) =>
    <route
      path={item.path}
      exact
      key={item.id || index} // add new id to the data itself
      render={() => item.component}
    />
  )}
</switch>

the reason is, by this documentation, component props can only accept a react component, not inline jsx. but you can use render to generate an inline jsx dynamically.


Related Query

More Query from same tag