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.
constructor(props, context) {
        super(props, context);
        this.setState({stateField: 'something'});
        this.state = {stateField: 'somethingelse'};
      }
      render() {
        return <div />;
      }
    }
    expect(() => {
      ReactTestUtils.renderIntoDocument(<StatefulComponent />);
    }).toWarnDev(
      "Warning: Can't call setState on a component that is not yet mounted. " +
        'This is a no-op, but it might indicate a bug in your application. ' +
        'Instead, assign to `this.state` directly or define a `state = {};` ' +
        'class property with the desired state in the StatefulComponent component.',
      {withoutStack: true},
    );
    
    ReactTestUtils.renderIntoDocument(<StatefulComponent />);
  });
  it('should correctly determine if a component is mounted', () => {
    class Component extends React.Component {