1.What is a ‘Controlled Component’?
A 'Controlled Component' is an input form element whose value is controlled by React.
2.Should we wait to store the users responses from the form into state when they submit the form OR should we update the state with their responses as soon as they enter them? Why.
By updating the state with the user's responses as soon as they enter them it offers benefits like real-time feedback, validation, and progress tracking.
3.How do we target what the user is entering if we have an event handler on an input field?
You can target what the user is entering by accessing the event object passed to the event handler function (event.target."whatever attribute")
The Conditional (Ternary) Operator Explained
1.Why would we use a ternary operator?
It makes writing conditional statements shorter and more concise.
2.Rewrite the following statement using a ternary statement:
console.log(x===y ? true : false);
if(x===y){
console.log(true);
} else {
console.log(false);
}