Bailing out of re-rendering in useState episode artwork

EPISODE · Nov 5, 2021 · 4 MIN

Bailing out of re-rendering in useState

from The Call Kent Podcast · host Kent C. Dodds

If useState contains a simple value like string or int, setting a new value that is the same as the existing value will not cause the component to re-render. However, if useState contains an object and I update the state with a new object that contains the exact same values, it will trigger the component to re-render. The React documentation says that is used Object.is to compare values. My 2 objects are identical, so why does the re-render happen? useState lazy initialization and function updates

Episode metadata supplied by the publisher feed · Published Nov 5, 2021

Embed this episode

NOW PLAYING

Bailing out of re-rendering in useState

0:00 4:28

No transcript for this episode yet

We transcribe on demand. Request one and we'll notify you when it's ready — usually under 10 minutes.

No similar episodes found.

No similar podcasts found.

Frequently Asked Questions

How long is this episode of The Call Kent Podcast?

This episode is 4 minutes long.

When was this The Call Kent Podcast episode published?

This episode was published on November 5, 2021.

Can I download this The Call Kent Podcast episode?

Yes. Use the download control on the episode player to save the publisher-provided media file.
URL copied to clipboard!