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.
state = {count: 1};
      static getDerivedStateFromProps(nextProps, prevState) {
        if (nextProps.updateState) {
          return {count: nextProps.incrementBy + prevState.count};
        }
        return null;
      }
      render() {
        return <div>{this.state.count}</div>;
      }
    }
    const shallowRenderer = createRenderer();
    let result = shallowRenderer.render(
      <SimpleComponent updateState={false} incrementBy={0} />,
    );
    expect(result.props.children).toEqual(1);
    result = shallowRenderer.render(
      <SimpleComponent updateState={true} incrementBy={2} />,
    );
    expect(result.props.children).toEqual(3);
    result = shallowRenderer.render(
      <SimpleComponent updateState={false} incrementBy={2} />,
    );
    expect(result.props.children).toEqual(3);
  });
  it('should not override state with stale values if prevState is spread within getDerivedStateFromProps', () => {
    class SimpleComponent extends React.Component {