最近第一次开始学习封装组件,遇到几个比较神奇的问题。
首先就是如果input外边包一个div,如果把input的onChange事件绑定到div上,也会生效
<div onChange={(e)=>{console.log(e.target.value)}}> <Input/> </div>
还有,如果封装了一个组件,那么里面的最外层元素的{...this.props}需要慎用,虽然这样子做,可以把样式传过来,并且生效,但是会报错