no-unused-state
Rule category
Correctness.
What it does
Warns unused class component state.
Examples
Failing
import React from "react";
class Example extends React.Component {
// Unused
state = {
foo: 1,
};
render() {
return null;
}
}
Passing
import React from "react";
class Example extends React.Component {
state = {
foo: 1,
};
render() {
return this.state.foo;
}
}