title: React state validation
body: <p>I would like to perform state validation on react component on every setState call and if new state is invalid, use another - valid state.</p>
  
  <p>For example, if I have slider, with 4 pages and I want to do </p>
  
  <pre><code>this.setState({
      page: 5
  });
  </code></pre>
  
  <p>In my validation function I'd check whether new state's value is greater than pages count and if so, I'd set 4 (total pages) instead of provided 5.</p>
  
  <p>Is this possible?
  Thanks</p>