2021-02-18
1598
#react
Adebola Adeniran
34347
Feb 18, 2021 â‹… 5 min read

React.memo vs. useMemo: Major differences and use cases

Adebola Adeniran Hi! I'm Adebola! I'm a full-stack React/Node.js and Ruby on Rails engineer from Nigeria. I mentor junior developers via the Google Developer Program, and I'm a regular contributor to some of the most widely read programming blogs. You can follow me on Twitter @debosthefirst.

Recent posts:

TypeScript logo over a pink and white background.

Drizzle vs. Prisma: Which ORM is best for your project?

Compare Prisma and Drizzle ORMs to learn their differences, strengths, and weaknesses for data access and migrations.

Temitope Oyedele
Nov 21, 2024 â‹… 10 min read
Practical Implementation Of The Rule Of Least Power For Developers

Practical implementation of the Rule of Least Power for developers

It’s easy for devs to default to JavaScript to fix every problem. Let’s use the RoLP to find simpler alternatives with HTML and CSS.

Timonwa Akintokun
Nov 21, 2024 â‹… 8 min read
Rust logo over black marble background.

Handling memory leaks in Rust

Learn how to manage memory leaks in Rust, avoid unsafe behavior, and use tools like weak references to ensure efficient programs.

Ukeje Goodness
Nov 20, 2024 â‹… 4 min read
Robot pretending to be a person.

Using curl-impersonate in Node.js to avoid blocks

Bypass anti-bot measures in Node.js with curl-impersonate. Learn how it mimics browsers to overcome bot detection for web scraping.

Antonello Zanini
Nov 20, 2024 â‹… 13 min read
View all posts

2 Replies to "<code>React.memo</code> vs. <code>useMemo</code>: Major differences and use cases"

  1. Nice easy to read article. But I think you should make it clear that React.memo and useMemo are completely different: the functional component is always being rerendered, which is rexecuted with the same props, as can be seen from react tools/highlight rerenders (even though with no dom changes to perform to perform in this particular case).

  2. In your useMemo use case, does it mean no re-rendering if UseMemoCounts component shows the same times when clicking cheese buttons? ParentComponent sends the same value as a prop to UseMemoCounts. It just shows the same number and it keeps re-rendering, doesn’t it?

Leave a Reply