In the header, I have a menu button that when clicked will display different links for the transition. However, I would just like to show the menu button when it is on the home path (ie "/"). And when I go to other pages, I would like to change the menu button to the back button . This return button should resemble a browser button that will return one step at a time until I get back to my home path. How can i achieve this? I use "react": "^ 15.1.0" and "reaction-router": "^ 2.5.2".
Appclient.js
ReactDom.render(( <Router history={hashHistory} > <Route path="/" component={App}> <IndexRoute component={Home} /> <Route path="home" component={Home}/> ... ... <Route path="profile" component={Profile}> <IndexRoute component={Timeline} /> <Route path="timeline" component={Timeline}/> </Route> <Route path="login" component={Login}/> </Router> ), reactContainer)
App.js
export default class App extends React.Component { render() { const _this = this; return ( <div> <Header/> ... ... </div> ); } }
Header.js
export default class Header extends React.Component { render() { return( <header> <div id="header-wrapper"> <div id="nav-bar-btn" class="nav">
javascript reactjs react-router
Benjamin smith max
source share