title: How to redirect from an action event in redux
body: <p>I want to redirect the client after an action has been fired. I heard of <code>react-redux-router</code>, but not sure how to properly implement it in the actions function.</p>
  
  <p>i followed a little bit of this </p>
  
  <p><a href="https://stackoverflow.com/a/42985875/10865515">https://stackoverflow.com/a/42985875/10865515</a></p>
  
  <p>However, when i submit the validated form, it doesn't redirect or refreshes. </p>
  
  <p><strong>Actions.js</strong></p>
  
  <pre><code> import { auth as firebaseAuth } from '../firebaseConfig'
   import { push,  browserHistory } from 'react-router-redux';
  
  
   export const signUp = (user) =&gt; { return (dispatch) =&gt; {
    firebaseAuth.createUserWithEmailAndPassword(user.email, user.password)
      .then(() =&gt; {
          dispatch({ type: 'SIGNUP_SUCCESS',
          payload: (action, state, res) =&gt; {
              return res.json().then(json =&gt; {
                browserHistory.push('/');
                return json;
              });
            },
      });
      }).catch((err) =&gt; {
          dispatch({ type: 'SIGNUP_ERROR', err});
      });
    }  
  }
  </code></pre>
  
  <p><strong>Reducers.js</strong></p>
  
  <pre><code>const initialState = {
    emailSignUp: '',
    passwordSignUp: '',
    authError: null
  
  }
  
  export default (state = initialState, action) =&gt; {
    switch (action.type) {
      case 'SIGNUP_SUCCESS':      
          return ({
              ...state,
              authError: null
          })
  
      case 'SIGNUP_ERROR':
          console.log('signup error')
          return ({
              ...state,
              authError: action.err.message
          })
      default:
          return state
   }
  } 
  </code></pre>
  
  <p><strong>Register.js</strong></p>
  
  <pre><code>// ...
  handleSubmit(event) {
      event.preventDefault();
  
      const {formData, errors} = this.state;
      const {email, password} = formData;
  
      const myError = this.props.authError;
      const creds = {
          email,
          password
      }
      const register = this.props.signUp(creds);
      if (register) {
          console.log(creds);
  
      }
  }
  </code></pre>