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.
return null;
      }
      render() {
        return null;
      }
    }
    const div = document.createElement('div');
    expect(() => ReactDOM.render(<MyComponent />, div)).toWarnDev(
      '`MyComponent` uses `getDerivedStateFromProps` but its initial state is ' +
        'undefined. This is not recommended. Instead, define the initial state by ' +
        'assigning an object to `this.state` in the constructor of `MyComponent`. ' +
        'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.',
      {withoutStack: true},
    );
    
    ReactDOM.render(<MyComponent />, div);
  });
  it('should invoke both deprecated and new lifecycles if both are present', () => {
    const log = [];
    class MyComponent extends React.Component {
      componentWillMount() {
        log.push('componentWillMount');
      }
      componentWillReceiveProps() {
        log.push('componentWillReceiveProps');
      }
      componentWillUpdate() {
        log.push('componentWillUpdate');
      }
      UNSAFE_componentWillMount() {