In my new react-redux app (I'm a newbie to react), I'm using Material-UI and have added material-ui tabs on my web app. The tabs are intended to change the URL upon selection which I achieved using the following piece of code.
function handleActive(tab) {
browserHistory.push(tab.props['data-route']);
}
I want my tabs to show selected tab indicator when I visit the routes manually instead of clicking on the tabs. Which I'm right now not able to figure out. Can anyone suggest me a way to do that either by react or redux? Let me know, If I'm not clear in my question.
UPDATE
Code in my components render(). There is nothing else in component.
render() {
function handleActive(tab) {
browserHistory.push(tab.props['data-route']);
}
return (
<Paper>
<Toolbar className="navbar">
<ToolbarGroup>
<Link to="/" style={{ textDecoration: 'none' }}>
<ToolbarTitle style={this.styles.title} text="Test App" />
</Link>
</ToolbarGroup>
<ToolbarGroup className="tab-container">
<Tabs className="tabs">
<Tab data-route="/" onActive={handleActive} className="tab" label="Route A" />
<Tab data-route="/routeB" onActive={handleActive} className="tab" label="Route B" />
<Tab data-route="/routeC" onActive={handleActive} className="tab" label="Route C" />
<Tab data-route="/routeD" onActive={handleActive} className="tab" label="Route D" />
</Tabs>
</ToolbarGroup>
</Toolbar>
</Paper>
);
}