UseCallback
UseCallback Interview Questions
2 curated usecallback interview questions with detailed answers and examples.
← Browse all interview questionsuseCallback memoizes a function reference so child components wrapped in React.memo skip re-rendering when the parent re-renders. Without React.memo on the child, useCallback adds overhead with no benefit. The dependency array must include every value the callback closes over.
advancedperformance optimizationreactuseCallbackoptimization
useMemo caches a computed value; useCallback caches a function reference. useCallback(fn, deps) is equivalent to useMemo(() => fn, deps). useCallback without React.memo on the child adds overhead with no benefit. Both require an accurate dependency array to avoid stale closures.
intermediateperformance optimizationreactuseMemouseCallback