Skip to content

Invalid react/no-direct-mutation-state in constructor #1382

Closed
@emmanuelgautier

Description

In the following special case, the react/no-direct-mutation-state rule throw an invalid error

class OneComponent extends Component {
  constructor() {
    super();

    class AnotherComponent extends Component {
      constructor() {
        super();
      }
    }

    this.state = {};
  }
}

A better way is to not declare a component into another component constructor but that is an invalid linter error .

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions