React transmission request which componentDidMount

Pic2

in conclusion:

  1. componentDidmount Is only performed after assembly is fully mounted, called this method setState will trigger re-rendering, most importantly, this is the official recommended!

  2. constructor Calls are at the beginning, the component is not mounted, it is not used.

  3. componentWillMount Call  constructor later, here's code calls  setState will not start re-rendered, so do not.

  4. Another does not appear here, but most heard argument is: in  componentWillMount a network request to render hinder the assembly's.

  5. Anyway, it is to be in  componentDidmount there with!

 

 

 

 

 

.

Guess you like

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