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.
React.useEffect(() => {
        effectsCalled.push('useEffect');
      });
      React.useLayoutEffect(() => {
        effectsCalled.push('useEffect');
      });
      return <div>Hello world</div>;
    }
    const shallowRenderer = createRenderer();
    shallowRenderer.render(<SomeComponent />);
    expect(effectsCalled).toEqual([]);
  });
  it('should work with useRef', () => {
    function SomeComponent() {
      const randomNumberRef = React.useRef({number: Math.random()});
      return (
        <div>
          <p>The random number is: {randomNumberRef.current.number}</p>
        </div>
      );
    }
    const shallowRenderer = createRenderer();
    let firstResult = shallowRenderer.render(<SomeComponent />);
    let secondResult = shallowRenderer.render(<SomeComponent />);
    expect(firstResult).toEqual(secondResult);
  });
  it('should work with useMemo', () => {
    function SomeComponent() {