reading-notes

Class 4 Notes

What is a ‘Controlled Component’?

An input value whose value us 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.

Generally speaking we should wait until th user is done with the form so its a smoother user experience. Although there may be circumstances where one answer can help answers later in the form.

How do we target what the user is entering if we have an event handler on an input field?

You can add a name attritbute to the element

Why would we use a ternary operator?

It is less code to write.

Rewrite the following statement using a ternary statement:

x===y ? ‘True’ : ‘False’;