Есть ли способ в реагирующем маршрутизаторе получить текущий компонент на коммутаторе?
const routes = {Home, ...}
<Layout>
<Switch>
{routes.map(r => <Route path={r.path} component={r.Component} />)} // I want to get this Component
</Switch>
</Layout>
function Layout(props) {
// I want to get the current component here
return props.children
}