code: function (publicInstance, completeState, callback) {
      var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
  
      if (!internalInstance) {
        return;
      }
  
      internalInstance._pendingStateQueue = [completeState];
      internalInstance._pendingReplaceState = true;
  
      // Future-proof 15.5
      if (callback !== undefined && callback !== null) {
        ReactUpdateQueue.validateCallback(callback, 'replaceState');
        if (internalInstance._pendingCallbacks) {
          internalInstance._pendingCallbacks.push(callback);
        } else {
          internalInstance._pendingCallbacks = [callback];
        }
      }
  
      enqueueUpdate(internalInstance);
    }
docs: Replaces all of the state. Always use this or `setState` to mutate state.
  You should treat `this.state` as immutable.
  
  There is no guarantee that `this.state` will be immediately updated, so
  accessing `this.state` after calling this method may return the old value.
  
  @param {ReactClass} publicInstance The instance that should rerender.
  @param {object} completeState Next state.
  @internal