Junior From PDF React React.js

What is useCallback and when should it be used?

useCallback memoizes a function to avoid unnecessary re-creations.

✅ Syntax:

const memoizedCallback = useCallback(() => {

doSomething(a, b);

}, [a, b]);

✅ Use case:

  • Prevents unnecessary re-renders of child components receiving functions as props.

const handleClick = useCallback(() => {

console.log("Clicked!");

}, []);

More from React.js Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details