A controlled component is a component that renders form elements and controls them by keeping the form data in the component’s state.
In a controlled component, the form element’s data is handled by the React component (not DOM) and kept in the component’s state. A controlled component basically overrides the default behavior of the HTML form elements.
We create a controlled component by connecting the form element (<input>, <textarea> or <select>) to the state by setting its attribute value and the event onChange.
https://stackoverflow.com/questions/42522515/what-are-react-controlled-components-and-uncontrolled-components#:~:text=A%20controlled%20component%20is%20a,kept%20in%20the%20component’s%20state.
Since the handleChange runs on every keystroke to update the React state, the displayed value will update as the user types.
this.state.value
It is just as effective while beng more efficient to type out.
if(x===y){
console.log(true);
} else {
console.log(false);
}
((x===y) ? ‘true’ : ‘false’;)