Skip to main content
D
React
React useCallback Hook

React useCallback Hook

The useCallback Hook caches function definitions to improve performance.

Read Time
5 min read
Difficulty
Beginner
Last Updated
Jun 15, 2026
Version
v1.0.0

Introduction

React recreates every function inside a component every time the component renders. If you pass these functions to child components, it causes unnecessary re-renders. The `useCallback` Hook caches the actual function itself so it doesn't get recreated.

Example

Example
1/* this caches a function */
2import { useCallback } from "react";
3
4function Parent({ data }) {
5  const handleClick = useCallback(() => {
6    console.log("Clicked!");
7  }, []); // Caches the function forever
8}

Key Points

  • It is almost identical to `useMemo`.
  • `useMemo` caches the *result* of a function.
  • `useCallback` caches the *function itself*.
  • It prevents unnecessary child component renders.

Up Next

Continue your journey with the next topic.

Go to React Custom Hooks