React的类组件事件需要bind,是因为jsx通过babel转换变成了React.createElement(type, props, rootContainerElement, parentNamespace),而事件在props中,最后是被一个函数调用this.xxx方法。因为React是严格模式写的,所以导致函数中的this如果没有明确指向,那就指向undefined
展开
评论