Display Back button to go back like the browser back button when not in home path
<p>In the header, I have a <strong>menu button</strong>, that when clicked will display different links to go to. However, I would only like to show the menu button when its in the home path (i.e., "/"). And when I navigate to other pages, I would like to change the the menu button to <strong>back button</strong>. This back button  should be like the browser back button which will go back one step at a time, till I get back to the home path. How can I achieve this? I am using "react": "^15.1.0" and "react-router": "^2.5.2".</p>

<p>AppClient.js</p>

<pre><code>ReactDom.render((
    &lt;Router history={hashHistory} &gt;
        &lt;Route path="/" component={App}&gt;
            &lt;IndexRoute component={Home} /&gt;
            &lt;Route path="home" component={Home}/&gt;
            ...
            ...
            &lt;Route path="profile" component={Profile}&gt;
                &lt;IndexRoute component={Timeline} /&gt;
                &lt;Route path="timeline" component={Timeline}/&gt;
        &lt;/Route&gt;
        &lt;Route path="login" component={Login}/&gt;
    &lt;/Router&gt;
  ), reactContainer)
</code></pre>

<p>App.js</p>

<pre><code>export default class App extends React.Component {
    render() {
        const _this = this;
        return (
            &lt;div&gt;
                &lt;Header/&gt;
                ...
                ...
            &lt;/div&gt;
        );
    }
}
</code></pre>

<p>Header.js</p>

<pre><code>export default class Header extends React.Component {
    render() {
        return(
            &lt;header&gt;
                &lt;div id="header-wrapper"&gt;
                    &lt;div id="nav-bar-btn" class="nav"&gt;

                        // change Menu when its not home path that is "/"
                        &lt;Menu&gt;
                        // to Back
                        &lt;Back&gt;

                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/header&gt;
        );
    }

}
</code></pre>