react/no-unused-class-component-methods

February 9, 2026 ยท View on GitHub

๐Ÿ“ Disallow declaring unused methods of component class.

Warns you if you have defined a method or property but it is never being used anywhere.

Rule Details

The following patterns are considered warnings:

class Foo extends React.Component {
  handleClick() {}
  render() {
    return null;
  }
}

The following patterns are not considered warnings:

class Foo extends React.Component {
  static getDerivedStateFromError(error) {
    return { hasError: true };
  }
  action() {}
  componentDidMount() {
    this.action();
  }
  render() {
    return null;
  }
}
});