React中遇到的问题 发表于 2019-09-24 | 更新于: 2020-02-24 | 分类于 React 父=>子组件通讯父组件: 1234567891011//元素:<child onRef={this.onRef} /><p onClick={this.click.bind(this)}>父组件的点击事件</p>//方法:click = () =>{ this.child.childFunction()}onRef = (ref) =>{ this.child=ref} 子组件: 12345//方法:componentDidMount(){ this.props.onRef(this);}childFunction(){ }