1.?
```
<p ref="stringRef"></p>
this.$refs.stringRef.textContent
```
2.?
```
<p ref={ ele => ( this.aaaRef = ele)}></p>? //?ele就是當(dāng)前實例
this.aaaRef.textContent
```
3.
```
?constructor(){
? ? this.objRef = React.createRef();?
? ?// { current: null }
? ?}
this.objRef.current.textContent
<p ref={this.objRef}></p>
```
=========
forwardRef
```
const?NextComponet = React.forwardRef((props, ref)? => (
? ? <input type="text" ref={ref} />
))
class Comp extends React.Component{
? ? constructor(){
? ? ? ? super();
? ? ? ? this.ref = React.createRef();
????}
? ? componentDidMount(){
? ? ? ? this.ref.current.value = 'ref!!!'
????}
? ? render(){
? ? ? ? return <NextComponet ref={this.ref} />
????}
}
```