react three attribute state props refs
Others
2019-09-06 03:07:21
views: null
react
- State (store data)
- Add state in the class definition component is added directly added to this.state = {} manner constructor constructor
- Modified by changes state this.setState ({})
- Access by this.state. Attribute name
- The props (component tag set attributes)
- Access accessed through this.props. Attribute name (value props can not be changed, the value of the state can be changed)
- Set an initial value
- Set App.defaultProps = {}
- Static defaultProps directly in the class definition of component {} = set (currently only available in scaffolding)
- refs (acquired by operation of virtual real dom dom)
- Value ref is a string of elements can be obtained directly through the value set this.refs.ref and related properties
- 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
- State (store data)
- Add state in the class definition component is added directly added to this.state = {} manner constructor constructor
- Modified by changes state this.setState ({})
- Access by this.state. Attribute name
- The props (component tag set attributes)
- Access accessed through this.props. Attribute name (value props can not be changed, the value of the state can be changed)
- Set the initial value
- Set App.defaultProps = {}
- Static defaultProps directly in the class definition of component {} = set (currently only available in scaffolding)
- refs (acquired by operation of virtual real dom dom)
- Value ref is a string of elements can be obtained directly through the value set this.refs.ref and related properties
- 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
Origin www.cnblogs.com/yangjingyang/p/11469126.html