We have moved to a new website!
If you are not redirected within 3 seconds, click here to go my homepage.
Difference between React and ReactDOM
Lifting state up
Lifting state up in react means moving data from a child component to some parent component either to use it there or pass it some other child component.
- When you want to coordinate two components, move their state to their common parent.
- Then pass the information down through props from their common parent.
- Finally, pass the event handlers down so that the children can change the parent’s state.
- It’s useful to consider components as “controlled” (driven by props) or “uncontrolled” (driven by state).
Controlled and uncontrolled components
It is common to call a component with some local state “uncontrolled”.
In contrast, you might say a component is “controlled” when the important information in it is driven by props rather than its own local state. This lets the parent component fully specify its behavior.
When writing a component, consider which information in it should be controlled (via props), and which information should be uncontrolled (via state). But you can always change your mind and refactor later.
What is React?
Material UI and Emotion
When a component's props or state change, React decides whether an actual DOM update is necessary by comparing the same with Virtual DOM...