- ref:react对真实dom的引用
- ref在reactElement上
{ this.div = ref; }}>
console.log(this.button)
> 真实的DOM
- ref在react组件上
console.log(this.button)
> Button {props: Object, context: Object, refs: Object, updater: Object, _reactInternalInstance: ReactCompositeComponentWrapper…}
//拿到的不是真实dom而是组件实例
//需要用ReactDom.findDOMNode来拿到真实DOM
ReactDom.findDOMNode(this.button)