react 相关 (箭头函数,props ,ref)

箭头函数

react 在使用箭头函数时 this的指向是定义时所在的对象 而不是使用时所在的对象。

所以不需要this.getdata = this.getdata.bind()

props

props的值是所有组件'父,子'都可以用到的值 可用在传值的时候

ref

自我理解为 用于获取当前dom元素 

但官方不推荐这样写 所以

this.conten = input} type="text"/> 

获取这个dom 用 this.conten 获取 conten为自定义

你可能感兴趣的:(react 相关 (箭头函数,props ,ref))