title: this.setState() does not work in componentWillReceiveProps
body: <p>I have a login page in which I am using <code>componentWillReceiveProps</code> to route to the next page. But the <code>state</code> that I am setting inside <code>componentWillReceiveProps</code> does not seem to set.</p>
  
  <p>This is my <code>componentWillReceiveProps</code> method :</p>
  
  <pre><code>  componentWillReceiveProps(nextProps) {
        if (nextProps.isAuthenticated === true) {
            browserHistory.push('/home');
        } else {
          console.log("this.props :::" + JSON.stringify(this.props))
            console.log("this.state :::" + JSON.stringify(this.state))
            console.log("nextProps :::" + JSON.stringify(nextProps))
            this.setState({
                errorMessage: nextProps.authenticationError
            })
            console.log("this.state :::" + JSON.stringify(this.state))
        }
    }
  </code></pre>
  
  <p>The <code>console output</code> I am getting is this :</p>
  
  <pre><code>this.props :::{"authenticationError":null}  
  this.state :::{"username":"35135","password":"3135","errorMessage":""}  
  nextProps :::{"isAuthenticated":false,"authenticationError":"Could not find user in DB."}  
  this.state :::{"username":"35135","password":"3135","errorMessage":""}  
  </code></pre>
  
  <p>Here even after setting the state, my state has not changed.</p>
  
  <p>Please tell me what is it that I'm doing wrong.</p>
  
  <p><strong>EDIT:</strong> I have this component which is <code>ErrorText</code> , which takes in the <code>errroMessage</code> property. </p>
  
  <pre><code>&lt;ErrorText errorMsg={this.state.errorMessage}&gt;&lt;/ErrorText&gt;
  </code></pre>