React Controlled Components
Learn how to turn the Search component and its input field into a controlled component.
We'll cover the following...
We'll cover the following...
Controlled components are not necessarily React components, but HTML elements. Let’s learn how to turn the Search
component and its input field into a controlled component.
Let’s go through a scenario that shows why we should follow the concept of controlled components throughout our React application. After applying the following change – giving the searchTerm
an initial state – can you spot the mistake in your browser?