constructor(props){ super(props) this.myRefs = React.createRef(); } refFun(){ const node = this.myRefs.current node.style.color = "red" } render() { return ( <div> <button ref={this.myRefs} onClick={this.refFun.bind(this)}>refs点击按钮</button> </div> ) }