React router browser back button isn't working
<p>I'm trying to create a multi step form using React JS and react-router. </p>

<p>The form step is changed with state. If I click on the button next the state step is incremented and the next step is shown. </p>

<p>But this way if I'm on for example third step and I click on the back in the browser I'm redirected to the home page instead of a previous step.</p>

<p>My main component is something like this :</p>

<pre><code>componentWillMount(){
    console.log(this.props.params.id);
}

onButtonClick(name, event) {
    event.preventDefault();

    switch (name) {
        case "stepFourConfirmation":
            if(this.validation("four")) {
                this.props.actions.userRegistrationThunk(this.state.user);
                this.setState({step: 5, user: {}});
            }
            break;
        case "stepTwoNext":
            if(this.validation("two")) {
                this.setState({step: 3});
                this.context.router.push("stepThree");
            }
            break;
        case "stepThreeFinish":
            this.setState({step: 4});
            break;
        default:
            if(this.validation("one")) {
                this.setState({step: 2});
                this.context.router.push('stepTwo');
            }
    }
}
</code></pre>

<p>On every button click I push the parameter to the url and change the step. When I click next it's working perfect. In componentWillMount I'm trying to get the parameter from the url and I would than decrement the step depending on the parameter. </p>

<p>But only when the first step is loaded I se stepOne in the console. If I click on next I get <em>[react-router] Location "stepTwo" did not match any routes</em></p>

<p>My routes.js file is as follows : </p>

<pre><code>    import React from 'react';
import {IndexRoute, Route} from 'react-router';

import App from './components/App';
import HomePage from './components/HomePage';
import Registration from './components/registration/RegistrationPage';

import UserPage from './components/user/userHome';
import requireAuth from './common/highOrderComponents/requireAuth';
import hideIfLoggedIn from './common/highOrderComponents/hideIfLoggedIn';

import PasswordReset from './common/passwordReset';

const routes = (
    &lt;Route path="/" component={App}&gt;
        &lt;IndexRoute component={HomePage}/&gt;
        &lt;Route path="registration/:id" component={hideIfLoggedIn(Registration)}/&gt;
        &lt;Route path="reset-password" component={PasswordReset} /&gt;
        &lt;Route path="portal" component={requireAuth(UserPage)} /&gt;
    &lt;/Route&gt;
);

export default routes;
</code></pre>

<p>Any advice how to solve it?</p>