React Docs - Forms
-
What is a ‘Controlled Component’? We can combine 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. An input form element whose value is controlled by React in this way is called a “controlled component”.
-
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. update value using set.State by users response as soon as enter them.to be dynamic as html.
-
How do we target what the user is entering if we have an event handler on an input field? the displayed value will always be this.state.value
The Conditional (Ternary) Operator Explained
-
Why would we use a ternary operator? to decision making in place of longer if and else conditional statements.
-
Rewrite the following statement using a ternary statement if(x===y){ console.log(true); } else { console.log(false); } solution:
x===y?console.log(true):console.log(false);