Skip to content

react-hooks/rules-of-hooks false positives inside class instances (not class components) #35264

@romgrk

Description

@romgrk

We use classes to organize our code, and the eslint rule react-hooks/rules-of-hooks always warns about hooks not being usable inside class components, regardless if the class is a component.

Reproduction

class Store {
  use() {
    return React.useState(4)
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions