<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/dSh2ZiSS3" -->

---
title: Understanding the difference between useMemo and useCallback
description: React provides us with two built-in hooks to optimize the performance of our app. At first glance, it might look like their usage is quite similar, so it can...
canonical: https://daily.dev/posts/understanding-the-difference-between-usememo-and-usecallback-dsh2ziss3
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Understanding the difference between useMemo and useCallback | daily.dev
og:description: React provides us with two built-in hooks to optimize the performance of our app. At first glance, it might look like their usage is quite similar, so it can...
og:url: https://daily.dev/posts/understanding-the-difference-between-usememo-and-usecallback-dsh2ziss3
og:image: https://api.daily.dev/og/posts/dSh2ZiSS3.png
og:image:alt: Understanding the difference between useMemo and useCallback
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Understanding the difference between useMemo and useCallback

**[gitconnected](https://daily.dev/sources/gc)** · 4 min read · 15 upvotes · 3 comments

## Summary

React provides us with two built-in hooks to optimize the performance of our app. At first glance, it might look like their usage is quite similar, so it can get confusing about when to use each. To clear that confusion, let’s dig in and understand the actual difference and the correct way to use them both.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://medium.com/@sveta.slepner/understanding-the-difference-between-usememo-and-usecallback-ec956adb2004>

## Community discussion

Top comments from developers on daily.dev.

**@sshanzel** · 7 upvotes

> useMemo - Returns the value or reference returned by the callback itself.
>
> useCallback - Returns the callback itself.
>
> When any of the dependencies change:
> - useMemo: will recompute the value or reference it returns (callback will be triggered).
> - useCallback: will recreate the callback itself.

**@elonmusk** · 0 upvotes

> there should be a save button here also @admin

---

Tags: [#react](https://daily.dev/tags/react)

[View this post on daily.dev](https://daily.dev/posts/understanding-the-difference-between-usememo-and-usecallback-dsh2ziss3)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Understanding the difference between useMemo and useCallback","url":"https://daily.dev/posts/understanding-the-difference-between-usememo-and-usecallback-dsh2ziss3","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/understanding-the-difference-between-usememo-and-usecallback-dsh2ziss3"},"datePublished":"2020-09-07T03:35:25.479Z","dateModified":"2021-10-07T14:17:10.317Z","description":"React provides us with two built-in hooks to optimize the performance of our app. At first glance, it might look like their usage is quite similar, so it can...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/edf388cd1c5ed5178607262ee8a9afed","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/edf388cd1c5ed5178607262ee8a9afed","isAccessibleForFree":true,"articleSection":"gitconnected","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"gitconnected","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/gc","url":"https://daily.dev/sources/gc"},"commentCount":3,"discussionUrl":"https://daily.dev/posts/understanding-the-difference-between-usememo-and-usecallback-dsh2ziss3","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":15},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":3}],"keywords":"react","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"gitconnected","item":"https://daily.dev/sources/gc"},{"@type":"ListItem","position":3,"name":"Understanding the difference between useMemo and useCallback"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/understanding-the-difference-between-usememo-and-usecallback-dsh2ziss3","comment":[{"@type":"Comment","text":"useMemo - Returns the value or reference returned by the callback itself.\nuseCallback - Returns the callback itself.\nWhen any of the dependencies change:\n\nuseMemo: will recompute the value or reference it returns (callback will be triggered).\nuseCallback: will recreate the callback itself.","datePublished":"2020-09-07T03:59:08.385Z","url":"https://daily.dev/posts/dSh2ZiSS3#c-dIAlWGaTL","author":{"@type":"Person","name":"Lee Hansel Solevilla","url":"https://daily.dev/sshanzel","image":"https://media.daily.dev/image/upload/v1682443582/avatars/avatar_ab02e61b958d49d88c8420b431a4d91c.jpg"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":7}},{"@type":"Comment","text":"there should be a save button here also @admin","datePublished":"2020-09-09T22:41:14.561Z","url":"https://daily.dev/posts/dSh2ZiSS3#c-bMfLhpXtR","author":{"@type":"Person","name":"Bonjour Comosava","url":"https://daily.dev/elonmusk","image":"https://avatars3.githubusercontent.com/u/12468730?v=4"}}]}
```

