reading-notes
My reading notes
Project maintained by brandomoki
Hosted on GitHub Pages — Theme by mattgraham
- What is a ‘Controlled Component’?
- controlled components usually maintain their own state
- 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.
- because there will be a re-render
- How do we target what the user is entering if we have an event handler on an input field?
Conditional (ternary) Operrator
- Why would we use a ternary operator?
- allows you to shorten an if statement to a one liner
- Rewrite the following statement using a ternary statement:
if(x===y){
console.log(true);
} else {
console.log(false);
answer = x === y ? (true) : (false):
console.log(answer);