React笔记——第二篇Ref


  onChange = () => {
    console.log(this.input);// ref的使用
  };
  render() {
    return (
      
<Input onChange={() => { this.onChange(); }} ref={(input) => { //ref是需要一个箭头函数,随便传递一个参数 this.input = input; }} >
); }

相关