我试图通过React库来理解React,但是在传入组件的context
和updater
方面无法理解。
以下是库中的代码:
function Component(props, context, updater) {
this.props = props;
this.context = context;
this.refs = emptyObject;
// We initialize the default updater but the real one gets injected by the
// renderer.
this.updater = updater || ReactNoopUpdateQueue;
}
这些东西的目的是什么?
ReactNoopUpdateQueue
或者React代码库中其他具有类似命名方法的对象吗?这些可能会回答您的一些问题 :-) - Sean Vieira