reading-notes

My reading notes journal for Code Fellows

View the Project on GitHub

*Readings: React and Forms

React Docs - Forms

  1. What is a ‘Controlled Component’? We can combine the two by making the React state be the “single source of truth”. Then the React component that renders a form also controls what happens in that form on subsequent user input. An input form element whose value is controlled by React in this way is called a “controlled component”.
  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. We should update the state with their responses as soon as they enter them.
  3. How do we target what the user is entering if we have an event handler on an input field? Formik.

The Conditional (Ternary) Operator Explained

  1. Why would we use a ternary operator? You can shorten your if statements into one line of code.
  2. Rewrite the following statement using a ternary statement:

     x===y ? 'true' : 'false';
    

References

https://reactjs.org/docs/forms.html https://codeburst.io/javascript-the-conditional-ternary-operator-explained-cac7218beeff