关于react 1.6 React.createRef创建的疑问
老版本的字符串创建一行代码搞定比如 <Pqgrid ref="mainGrid">,
现在需要先声明再绑定,比如:
伪代码:
constructor(props) {
super(props);
this.main = React.createRef();//声明
}
render() {
return (<div style={{width: '100%', height: '100%'}}>
<input ref={ this.main }/> //绑定
</div>);
感觉啰嗦死了,公司是做erp系统的,input都是几十个上百个, 每个input都要声明,然后绑定不累死? 各位大佬是否有 办法解决?