Since then, we have finished writing the Todolist component case. What knowledge points have we used from it?
-
1. Learn how to split components by function based on static page effects, and split the components into smaller components. Each component is responsible for a specific function.
-
2. In React,
className
andstyle={ {}}
have event attributes:onXxx
. -
3. Understand the difference between
defaultChecked
andchecked
attributes in React -
4. Get to know the new dependent library
nanoid
, which can generate uniqueUUID
-
5. Use
prop-types
dependent libraries to restrict the type and necessity ofprops
tag attributes -
6. Proficient use of array methods such as:
reduce/map/filter...
-
7. Dynamic initialization list, how to determine which component's state to put data in?
—1. Use of a certain component: put it in its own state
—2. Some components use: put in their common parent component state (officially called this operation: state promotion)
-
8. Regarding communication between father and son:
—1. [Parent component] passes data to [child component]: passed through props
—2. [Sub component] passes data to [Parent component]: passed through props, requiring the parent component to pass a function to the child component in advance
-
9. Where the state is, there are methods to operate the state.