React Hooks useMemo optimize application performance, problem solving subassemblies Repeat

effect:

 

useMemo mainly used to solve performance problems rendered useless produced using React hooks.

 

reason:

Use the form to declare the function of components, lost shouldCompnentUpdate (before the component update) the life cycle, which means that we have no way to pass the updated components before conditions to decide whether to update the component. 
And in the function component, no longer distinguish between mount and update two states, each call will be executed all internal logic of this means that the function module, to bring very large performance loss.

Program:

useMemo and useCallback are to solve the performance problems, this section first introduced useMemo.

 

 

 

 

 

 

.

Guess you like

Origin www.cnblogs.com/jianxian/p/12533264.html