1. function Component(props, context, updater) {
    2. this.props = props;
    3. this.context = context;
    4. // If a component has string refs, we will assign a different object later.
    5. this.refs = emptyObject;
    6. // We initialize the default updater but the real one gets injected by the
    7. // renderer.
    8. this.updater = updater || ReactNoopUpdateQueue;
    9. }
    10. Component.prototype.isReactComponent = {};
    1. Component.prototype.setState = function(partialState, callback) {
    2. if (
    3. typeof partialState !== 'object' &&
    4. typeof partialState !== 'function' &&
    5. partialState != null
    6. ) {
    7. throw new Error(
    8. 'setState(...): takes an object of state variables to update or a ' +
    9. 'function which returns an object of state variables.',
    10. );
    11. }
    12. this.updater.enqueueSetState(this, partialState, callback, 'setState');
    13. };
    1. Component.prototype.forceUpdate = function(callback) {
    2. this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
    3. };
    1. function ComponentDummy() {}
    2. ComponentDummy.prototype = Component.prototype;