title: React Hook useCallback received a function whose dependencies are unknown. Pass an inline function instead
body: <p>Consider this example:</p>
  <pre><code> let memoizedCb = React.useCallback(
      memoize((param) =&gt; () =&gt; someFunction(param)),
      []
    );
  </code></pre>
  <p>where <code>memoize</code> is from external library like &quot;fast-memoize&quot;. Above code gives warning:</p>
  <blockquote>
  <p>React Hook useCallback received a function whose dependencies are
  unknown. Pass an inline function instead</p>
  </blockquote>
  <p>I found <a href="https://github.com/facebook/react/issues/19240" rel="noreferrer">this</a> thread which if we adapt to my use case would suggest this as solution (<em>if I am not wrong</em>):</p>
  <pre><code>const memoizedCb = React.useMemo(
    () =&gt; memoize((param) =&gt; () =&gt; someFunction(param)),
    []
  );
  </code></pre>
  <p>What is the warning about? <strong>why</strong> does <code>useMemo</code> fix this problem?</p>
  <p>NOTE: <code>someFunction</code> is defined outside the function component so it is not needed as a dependency.</p>