- The state of form elements in an HTML/JavaScript project is tracked by <1>.
- A controlled component in React is really just a regular <2> that you are already familiar with.
- But the term refers to a component that has a form element whose <3> is tracked by <4>.
- The
valueof an<input />, for example, in a controlled component is set by the <5> part of theuseStatehook. - If an
<input />does not have a <6> attribute, its state is controlled by HTML. - Changes in state cause a React component to <7>.
- When component goes from controlled to uncontrolled, React will throw a <8>.
- The
onChangeevent listener listens to every <9>. - The
<input />of a controlled component will always have the <10> event listener as one of its attributes. - A controlled component must implement the <11> as well as have attributes for
valueandonChangeon the<input />element.
- component
- HTML
- keypress
- noun
onChange- re-render
- React
- state
useStatehookvalue- warning