title: React: Is it possible to stop code 'reading' until component will receive new props?
body: <p>I have a component, that has button that creates <code>newType</code> on click and sets it to state. 
  <code>types</code> comes from outside from parent component. How can I stop running the code at the moment when <code>this.props.onCreateClick(this.state.selectedDate)</code> runs and wait until I receive updated <code>types</code> so when I get updated <code>types</code> I could run next line? </p>
  
  <p>It's class component. That button is inside 
  Props example: <code>props: types = [{id: 1, name: 'One'}, {id: 2, name: 'Two'}]</code></p>
  
  <pre><code>this.state = {
     selectedDates: [Date], 
     currentType: null, 
  }
  
  &lt;button
      onClick={(e) =&gt; {
          this.props.onCreateClick(this.state.selectedDate)
          let newType = this.props.types[this.props.types.length - 1]; 
  
          this.setState({
              selectedDates: [], 
              currentType: newType.id
          })
      }}
  
  &gt;Create&lt;/button&gt;
  </code></pre>