title: React hooks: how to detect when particular state variable has updated
body: <p>Before React hooks, I would use <code>componentDidUpdate(prevProps, prevState)</code>, and if I wanted to execute given code only when <code>this.state.a</code> had updated, I'd do</p>
  <pre><code>if (prevState.a !== this.state.a) {
    &lt;...&gt;
  }
  </code></pre>
  <p>How can I achieve the same thing in <code>useEffect()</code>?</p>