title: Update React Hooks State During Render Using useMemo
body: <p>Can <code>useMemo</code> be used <em>just</em> to avoid extra referential equality checking code/vars when setting state <em>during</em> a render? </p>
  
  <p>Example: <code>useMemo</code> with a <code>setState</code> during render taken from this <a href="https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops" rel="noreferrer">rare documented use case</a>:</p>
  
  <pre class="lang-js prettyprint-override"><code>function ScrollView({row}) {
    let [isScrolling, setIsScrolling] = useState(false);
  
    const lessCodeThanCheckingPrevRow = useMemo(
      () =&gt; {
        // Row changed since last render. Update isScrolling.
        setIsScrolling(true); // let's assume the simplest case where prevState isn't needed here
      },
      [row]
    );
  
    return `Scrolling down: ${isScrolling}`;
  }
  </code></pre>
  
  <p>Above drastically reduces code and extra vars, only otherwise used for equality checks, so why do the docs imply referential equality checks should be done manually?</p>