I have two tabs: Profile and Friends and the navlink are as follows
<Navlink to={'/dashboard/profile/' + (tab.url) + '/' + userId}>{tab.name}</Navlink>
where tab = [{ "name": "Profile", "url": 'timeline' }, { "name": "Friends", "url": 'friends' }]
Inside my render() I have route defined as
<Route path="/dashboard/profile/:screenId/:userId" component={this.Routing}/>
where screenId is Timeline/Friends depending on which tab is clicked
and the Routing function is
Routing =({ match })=>{
userId = match.params.userId;
switch(match.params.screenId){
case "timeline": return <Timeline/>;
case "friends": return <Friends/>
default : return <NoMatch/>;
}
}
So the problem is whenever any tab is being selected, the url changes but the Routing function is not triggered so as a result the route is not working. Basically anything after /dashboard/profile/ doesn't work.
I also tried this inside my render():
<Switch>
<Route path="/dashboard/profile/timeline/userId" component={Timeline}/>
<Route path="/dashboard/profile/friends/userId" component={ContactUs}/>
</Switch>
But then also it is not working and the problem remains. Any help would be appreciated.