React17 high-order component of chained calls

  • Use as follows:
        * Write a higher-order component to add property
        * Write a high-level components written in the life cycle
        * Then more than two high-order components chained calls
 
Examples
  * Write high-order components add properties (return is a function of components):
 

 

 

  * Write high-order assembly to rewrite the life cycle (returns a class component):
 

 

 

* Chained calls
widthLearnReact add a property to HOC components, widthLiseCycle add a property HOC component life cycle overrides componentDidMount
  • Note This high level of component chained calls too much trouble, next essay using the syntax decorator deal with this problem.

Guess you like

Origin www.cnblogs.com/tengfeiS/p/12153131.html