- 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
value
of an<input />
, for example, in a controlled component is set by the <5> part of theuseState
hook. - 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
onChange
event 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
value
andonChange
on the<input />
element.
- component
- HTML
- keypress
- noun
onChange
- re-render
- React
- state
useState
hookvalue
- warning