Readings: React and Forms
React Docs - Forms
- What is a ‘Controlled Component’?
Controlled components in React are those in which form data is handled by the component's state.
Forms are used to store information in a document section.
The information from this form is typically sent to a server to perform an action.
- 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.
store data when they sumbmit a form, because data flow backwords needs a submit function
- How do we target what the user is entering if we have an event handler on an input field?
form validation.
The Conditional (Ternary) Operator Explained
- Why would we use a ternary operator?
It provides a way to shorten a simple if else block
- Rewrite the following statement using a ternary statement:
(x===y) ? consol.log(true) : console.log(false);