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.
const [state, dispatch] = React.useReducer(reducer, props, p => ({
        count: p.initialCount,
      }));
      if (state.count === 0) {
        dispatch({type: 'increment'});
      }
      return (
        <div>
          <p>
            The counter is at: <span>{state.count.toString()}</span>
          </p>
        </div>
      );
    }
    const shallowRenderer = createRenderer();
    let result = shallowRenderer.render(<SomeComponent initialCount={0} />);
    expect(result).toEqual(
      <div>
        <p>
          The counter is at: <span>1</span>
        </p>
      </div>,
    );
  });
  it('should not trigger effects', () => {
    let effectsCalled = [];
    function SomeComponent({defaultName}) {