- Is having a JavaScript function that handles the submission of the form and has access to the data that the user entered into the form.
2. 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.
- It's updated as soon as they enter, since handleChange runs on every keystroke to update the React state, the displayed value will update as the user types.
- By controlled input null value, which means specifying the value prop on a controlled component prevents the user from changing the input unless you desire so.
- Its shorter than the if statement
- Redues time
- More cleanr than if statement
if(x===y){
console.log(true);
} else {
console.log(false);
}
Ternanry statement:
if(x===y)
{ console.log(true); }
else
{ console.log(false);
}
===> x===y ? (console.log(true)) : (console.log(false))