What is a ‘Controlled Component’?
An input form element whose value is controlled by React.
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.
We wait to store the users responses from the form into state when they submit the form, because we wait to store the users responses from the form into state when they submit the form.
How do we target what the user is entering if we have an event handler on an input field?
When you need to handle multiple controlled input elements, you can add a name attribute to each element and let the handler function choose what to do based on the value of event.target.name.
Why would we use a ternary operator?
When we need to write an if statement in a one line code.
Rewrite the following statement using a ternary statement
x===y ? console.log(true) : console.log(false)