- In HTML, form elements such as (input) and (select) maintain their own state and update it based on user input.
- On the other hand , In React, mutable state is kept in the state property of components, and only updated with setState().
- controlled component is an input form element whose value is controlled by React in a way that combine the HTML form elements and the React mutable state's by making the React state be the “single source of truth”.
The React component that renders a form also controls what happens in that form on subsequent user input.
if ( condition ) {
value if true;
} else {
value if false;
}
condition ? value if true : value if false