title: Take an action on props change in ReactJS
body: <p>I need to use current props and previous props value in my React component.
  So i did it like this</p>
  
  <pre><code>state = {
      current: null,
      previous: null,
  };
  
  componentWillReceiveProps(nextProps) {
      if (nextProps.amount !== this.state.current) {
          this.setState({previous: this.state.current, current: nextProps.amount});
      }
  }
  
  ...
  
  render() {
      const {previous, current} = this.state;
  
      return (
          ...
          &lt;CountUp className="counter" start={previous} end={current} duration={1}/&gt;
          ...
      )
  }
  </code></pre>
  
  <p>It works fine, but is it good React practise to do it like this? Are there others "good" ways to do it?</p>