“controlled component” is a technique to controlle by combining the two by making the React state be the “single source of truth”. Then the React component that renders a form also controls what happens in that form on subsequent user input.

we should update the state with users responses as soon as they enter them Since the value attribute is set on our form element, the displayed value will always be this.state.value, making the React state the source of truth. Since handleChange runs on every keystroke to update the React state, the displayed value will update as the user types
using event.target in the event handelfunction. firstly, we Create the state to hold the input value. then, we Define the event handler to update the state when the user types into the input and finally, we Attach the event handler and set value attribute on the input field
we use a ternary operator to specify that a certain block of code should be executed if a certain condition is met.
if(x===y){ console.log(true); } else { console.log(false); }