react three attribute state props refs

react

  1. State (store data)
    1. Add state in the class definition component is added directly added to this.state = {} manner constructor constructor
    2. Modified by changes state this.setState ({})
    3. Access by this.state. Attribute name
  2. The props (component tag set attributes)
    1. Access accessed through this.props. Attribute name (value props can not be changed, the value of the state can be changed)
    2. Set an initial value
      1. Set App.defaultProps = {}
      2. Static defaultProps directly in the class definition of component {} = set (currently only available in scaffolding)  
  3. refs (acquired by operation of virtual real dom dom)
    1. Value ref is a string of elements can be obtained directly through the value set this.refs.ref and related properties
    2. Value ref is a function of an arrow as ref = {(h3) => this.doms = h3} doms play a role in the temporary storage element can operate directly dom attributes this.doms  
 
 
 
  1. State (store data)
    1. Add state in the class definition component is added directly added to this.state = {} manner constructor constructor
    2. Modified by changes state this.setState ({})
    3. Access by this.state. Attribute name
  2. The props (component tag set attributes)
    1. Access accessed through this.props. Attribute name (value props can not be changed, the value of the state can be changed)
    2. Set the initial value
      1. Set App.defaultProps = {}
      2. Static defaultProps directly in the class definition of component {} = set (currently only available in scaffolding)  
  3. refs (acquired by operation of virtual real dom dom)
    1. Value ref is a string of elements can be obtained directly through the value set this.refs.ref and related properties
    2. Value ref is a function of an arrow as ref = {(h3) => this.doms = h3} doms play a role in the temporary storage element can operate directly dom attributes this.doms  

Guess you like

Origin www.cnblogs.com/yangjingyang/p/11469126.html