Homepage

Project/progress updates!

View the Project on GitHub modopo/reading-notes

Reading Class 04

React Docs - Forms

1) A controlled component is a component that renders form elements and controls them by keeping the form data in the component’s state. In a controlled component, the form element’s data is handled by the React component (not DOM) and kept in the component’s state. For input/data received by user, it is kept in React’s state as a “single source of truth”.

2) We should update the their response as soon as possible to the state because other component may depend on the data in state.

3) We can update the state by setting its attribute value with the event onChange on the input field.

Conditional Ternary Operator

1) Ternary operators are used for readability, as it reduces the number of lines of code to test a single condition.

2) x === y ? console.log(true) : console.lg(false);

Things I want to know more about