Menu

React Controlled vs Uncontrolled Components
📰

React Controlled vs Uncontrolled Components

DEV Community: react·Boula Akladyous·9 days ago
#6uuPNNeb
#devtoreact#devto#dev#value#input
Reading 0:00
15s threshold

React makes it easy to manipulate data using forms.

One of the most common patterns you’ll see in React when dealing with forms is that we need to make React aware of changes to the form inputs when the user

types. This means that the component containing those input elements typically needs to keep track of the text in the input elements using state.

React supports two types of components: controlled components and uncontrolled components. Let’s uncover the main differences between controlled and

uncontrolled components.

Controlled Component

Unlike the uncontrolled component, the input form element in the controlled component is handled by the component rather than the DOM. It takes its current

value through props. The changes are notified through useState Hook.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.