pureComponent
来源:2-4 react-component
诺巴蒂
2019-03-07
pureComponentPrototype.constructor = PureComponent;
// Avoid an extra prototype jump for these methods.
Object.assign(pureComponentPrototype, Component.prototype);
这个地方没太理解,为什么要assign一下
写回答
2回答
-
DevinLin
2019-03-18
只是用来实现继承,这样写只是为了兼容性
00 -
诺巴蒂
提问者
2019-03-07
还有一个问题:
ComponentDummy
这个是做啥用的,为啥不直接继承 Compoent , 为了去除 Compoent 里的方法吗
032019-03-09
相似问题