See the issue and the test case with original fix in https://github.com/facebook/react/pull/14802.

We'll need to fix it properly, see https://github.com/facebook/react/pull/14802#issuecomment-463277621.
return {
    memoizedState: null,
    queue: null,
    next: null,
  };
}
function basicStateReducer<S>(state: S, action: BasicStateAction<S>): S {
  return typeof action === 'function' ? action(state) : action;
}
class ReactShallowRenderer {
  static createRenderer = function() {
    return new ReactShallowRenderer();
  };
  constructor() {
    this._context = null;
    this._element = null;
    this._instance = null;
    this._newState = null;
    this._rendered = null;
    this._rendering = false;
    this._forcedUpdate = false;