title: Question regarding benefit of React useCallback hook
body: <p>I am studying React, and I am stuck on understanding the benefits of <code>useCallback</code> hook. According to this <a href="https://felixgerschau.com/react-rerender-components/" rel="nofollow noreferrer">website</a>,</p>
  <blockquote>
  <p>In function components, the execution of the whole function is the equivalent of the render function in class components.</p>
  </blockquote>
  <p>If in the functional components, the whole function is executed on every render, doesn't that mean that the whole code would be re-executed afresh. As a result the <code>useCallback</code> hook would start from a clean state on each render, meaning that <code>useCallback</code> cache would be reinitialized and all previous cache entries would be lost?</p>