Chapter 7
- Components are the basic building blocks of React apps. The React component can be created using a JavaScript function or the ES6 class.
- The props and state are the input data for rendering the component. They are JavaScript objects, and the component is re-rendered when the props or state change.
- The data flow goes from the parent component to the child.
- The components that only have props are called stateless components. The components that have both props and a state are called stateful components.
- JSX is the syntax extension for JavaScript, and it is recommended that you use it with React.
- Handling events in React is similar to handling DOM element events. The difference in React is that event naming uses the camelCase naming convention—for example,
onClick
oronSubmit
. - We will often want to invoke a JavaScript function that has access to form data after the form submission. Therefore, we have to disable default behavior using the
preventDefault...