How to get Component from react-router v4 by path?
I'm looking for a way to get the component that configured before, by path.
Forexample I have got this Route:
import React from 'react';
import UserScreen from './UserScreen';
...
<Route path='/user/:id' component={UserScreen}/>
Now I want to get the UserScreen Component by the path. Something like this:
getComponentByPath(path){
// looking for this section
}
render(){
const component = getComponentByPath('/user/12');
return (<component />);
}
I'm looking for the Component object.