Controlled Component?HTML they maintain their own state and update it based on user input, but in React,the state for them is typically kept in the state property of components, and only updated with setState().So Controlled Component allow us to combine the two by making the React state be the single source of truth ,which means that the React component that renders a form also controls what happens in that form on subsequent user input.event handler that is runs on every keystroke to update the React state, the displayed value will update as the user types.{this.handleChange} with the same input field .
if(x===y){
console.log(true);
} else {
console.log(false);
}
x===y ? 'true' : 'false';References:
@React/Forms
@Brandon Morelli/JavaScript — The Conditional (Ternary) Operator Explained