title: How to setState to new data in react?
body: <p>I just started looking at reactjs and trying to retrieve data from an API:</p>
  
  <pre><code>constructor(){
      super();
      this.state = {data: false}
      this.nextProps ={};
  
      axios.get('https://jsonplaceholder.typicode.com/posts')
          .then(response =&gt; {
              nextProps= response;
          });
    }
  </code></pre>
  
  <p>When the promise returns the data, I want to assign it to the state:</p>
  
  <pre><code>componentWillReceiveProps(nextProps){
      this.setState({data: nextProps})
    }
  </code></pre>
  
  <p>How can I update the state with the data received from the API? At the moment the state is not set?</p>
  
  <p>jsbin ref:<a href="https://jsbin.com/tizalu/edit?js,console,output" rel="nofollow noreferrer">https://jsbin.com/tizalu/edit?js,console,output</a></p>