Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumReactcustom hooksSingle-choice MCQ

A custom hook returns a function that callers will pass to a child as a memoized callback. Why does wrapping that returned function in useCallback inside the hook still produce a NEW function on every render here?

function useTracker(events) { const log = useCallback((id) => { console.log(id, events.length); }, [events]); return log; } // caller function Parent() { const log = useTracker([]); // new array literal each render return <Child onClick={log} />; }