react artist 2021-02-02 146 阅读1分钟 react创建ref的方式 const Home = React.lazy(() => import("./view/Home")); 懒加载 this.inputRef = React.createRef(); <input ref={ this.inputRef } /> 第二种方式,直接定义一个函数 ref={(btn) => {this.btnRef = btn}}