See this example: https://github.com/facebook/react/issues/11508#issuecomment-345464797.

I think it probably reflects a misunderstanding of how props and state work, and we should detect and warn if we see this.
'componentDidUpdate() prevProps:foo prevState:1 snapshot:abc',
    ]);
    log.length = 0;
    ReactDOM.render(
      <div>
        <MyComponent value="baz" />
      </div>,
      div,
    );
    expect(log).toEqual([
      'render',
      'getSnapshotBeforeUpdate() prevProps:bar prevState:2',
      'componentDidUpdate() prevProps:bar prevState:2 snapshot:abc',
    ]);
    log.length = 0;
    ReactDOM.render(<div />, div);
    expect(log).toEqual([]);
  });
  it('should call getSnapshotBeforeUpdate before mutations are committed', () => {
    const log = [];
    class MyComponent extends React.Component {
      divRef = React.createRef();
      getSnapshotBeforeUpdate(prevProps, prevState) {
        log.push('getSnapshotBeforeUpdate');
        expect(this.divRef.current.textContent).toBe(
          `value:${prevProps.value}`,
        );
        return 'foobar';
      }
      componentDidUpdate(prevProps, prevState, snapshot) {