Class 04 Reading Notes
Home
Table of Contents
- React Forms
- Conditional (Ternary) Operator
- What is a ‘Controlled Component’? A React component that renders a form and also controls what happens in that form
- 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. **
- How do we target what the user is entering if we have an event handler on an input field?by using this.state.value
Conditional (Ternary) Operator
- Why would we use a ternary operator? in place of if/else statements to simplify a block of code to less lines
- Rewrite the following statement using a ternary statement:
if(x===y){
console.log(true);
} else {
console.log(false);
}
x===y ? console.log(true) : console.log(false)