react icon indicating copy to clipboard operation
react copied to clipboard

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

Open romgrk opened this issue 1 month ago • 1 comments

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)
  }
}

romgrk avatar Dec 01 '25 15:12 romgrk

Hi @eps1lon, I have solved this issue. Please review it

hukshh avatar Dec 03 '25 09:12 hukshh