midReact Hooks
What is useCallback and when should it be used?
Updated May 6, 2026
Short answer
useCallback memoizes functions to prevent unnecessary re-creations.
Deep explanation
It is useful when passing callbacks to optimized child components that rely on reference equality.
Real-world example
Optimizing re-renders in lists and child components.
Common mistakes
- Using it without memoized children, adding unnecessary complexity.
Follow-up questions
- When does useCallback help performance?
- Does it always prevent re-renders?