I have a component called Profile and it has two children components Timeline and Friends.
I can route to the timeline component inside profile from any other component like this:
<Link to={{ pathname: '/dashboard/profile/timeline/'+userId}}></Link>
But once I am in this url, after that if I want to route to friends section, which is a sibling to timeline I try routing using this in Profile component
<Route path="/dashboard/profile/:screenId/:userId" component={this.Routing}/>
where Routing function is
Routing =({ match })=>{
switch(match.params.screenId){
case "timeline": return <Timeline/>;
case "friends": return <Friends/>
default : return <NoMatch/>;
}
}
But the problem is it is not working, the Routing function is not being triggered when I click on the navlink
<NavLink to={'/dashboard/profile/' + (tab.url) + '/' + userId} activeClassName="selectedTab">
<div>{tab.name}</div>
</NavLink>
This navlink is in the Profile component. Any help would be appreciated.