title: Call a method in getDerivedStateFromProps
body: <p>Currently my code is like so:</p>
  
  <pre><code>componentWillReceiveProps(nextProps: any) {
    this.showLockedWarning(nextProps);
  }
  </code></pre>
  
  <p>but due to the <code>componentWillReceiveProps</code> getting deprecated, I'd like to use the function that has no such problems and as far as I see, I should have 2 options - <code>getDerivedStateFromProps</code> and <code>componentDidUpdate</code>.</p>
  
  <p>I can't use <code>componentDidUpdate</code> because that creates an infinite loop, but from <code>getDerivedStateFromProps</code> I can't access <code>this</code> keyword. What could I do in this case?</p>