react assembly constructed in three ways

1, pure function -

  • Component is not instantiated, overall rendering performance gains
  • Component can not access thisobjects
  • The method of assembly can not access the life-cycle
  • Stateless components can only access the input of propsthe same propswill get the same rendering results, there will be no side effects

2,React.createClass

  • React.createClass binding function method will automatically lead to unnecessary performance overhead
  • React.createClass of mixins is not natural, intuitive

3,React.Component

  react.Component form ES6 to create thereactassembly, is extremely React currently has recommended way to create a state assembly, with respect toReact.createClassbetter achieve code reuse.

  Binding this application can bind call apply props. a first assembly component when using this super

Guess you like

Origin www.cnblogs.com/tiepeng/p/11711429.html