- Form elements naturally keep an internal state
<input>,<textarea>,<select>
- Controlled Components - an input form element whose value is controlled by the React state as the "single source of truth"
- Input values should always be set via controlled components, that way they are updated as the user types in the information on each keystroke and this information is made available for other elements or event handlers. (think fuzzy search)
- use a state value attribute to controll an imput element
condition ? value if true : value if false;
- condition, what you are testing
- result should always be or coerce to a boolean true or false
- ternary operators can be nested
- multiple operations can be run using comma separation
- use to shorten if statements into single lines of code
Original Code:
if(x===y){
console.log(true);
} else {
console.log(false);
}
Ternary Code:
x===y ? console.log(true) : console.log(false);
Bootstrap Forms React Conditional Rendering
- TBD