Skip to content
Controlled and uncontrolled components episode artwork

EPISODE · Aug 28, 2024 · 47 MIN

Controlled and uncontrolled components

from Frontend First · host Frontend First

Sam and Ryan discuss controlled and uncontrolled components in React. They talk about how uncontrolled components can be thought of as components that manage their own internal state, why you should model your complex React components after the simpler APIs of native HTML elements like inputs, why you shouldn't try to make components that are both controlled and uncontrolled, and why making a new component boundary is sometimes all you need to make your custom components behave more predictably. Timestamps: 0:00 - Intro 1:41 - What are controlled and uncontrolled components? 6:11 - How to change a component from uncontrolled to controlled 8:48 - How do you decide when to use a controlled or uncontrolled component? 12:00 - Sortable table example and a single source of truth 15:27 - Is it always either controlled or uncontrolled? 21:09 - Color picker example and not exposing internal state 28:46 - Sortable list example with Framer Motion 39:45 - Component boundaries and wearing two hats: the library author vs. library consumer 41:43 - How do you know if you are using the wrong approach? Links: New course: Advanced React Component Patterns React docs: Controlled and uncontrolled components React docs: Storing state from previous renders Email Sam Email Ryan Frontend First on Twitter

Episode metadata supplied by the publisher feed · Published Aug 28, 2024

Embed this episode

Sam and Ryan discuss controlled and uncontrolled components in React. They talk about how uncontrolled components can be thought of as components that manage their own internal state, why you should model your complex React components after the simpler APIs of native HTML elements like inputs, why you shouldn't try to make components that are both controlled and uncontrolled, and why making a new component boundary is sometimes all you need to make your custom components behave more predictably.

Distinct summary based on available episode metadata or transcript content.

Ready to play

Controlled and uncontrolled components

0:00 47:25

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 Frontend First?

This episode is 47 minutes long.

When was this Frontend First episode published?

This episode was published on August 28, 2024.

Can I download this Frontend First episode?

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