React HOOK rules:
Hooks can only appear at the top level.
Don’t call hooks in loops, conditions, or nested functions.
PureComponet and memo
PureComponet usage:
memo usage
userCallback
useReducer
useContext
Insufficient React Hooks
Although we have seen the power of React Hooks through the above examples, it seems that class components can be completely rewritten using React Hooks. However, in the current v16.8 version, the two life cycle functions in class components, getSnapshotBeforeUpdate and componentDidCatch, cannot be implemented yet. The official also plans to implement it in React Hooks in the near future.