react/no-is-mounted
eslint-plugin-react
No autofixRecommended
eslint.config.js
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/no-is-mounted": "error",
},
},
];var Hello = createReactClass({
handleClick: function() {
setTimeout(function() {
if (this.isMounted()) {
return;
}
});
},
render: function() {
return <div onClick={this.handleClick.bind(this)}>Hello</div>;
}
});var Hello = createReactClass({
render: function() {
return <div onClick={this.props.handleClick}>Hello</div>;
}
});Examples from the ESLint documentation.
react/no-is-mounted
eslint-plugin-react
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/no-is-mounted": "error",
},
},
];react/no-is-mounted
react plugin · correctness
{
"plugins": [
"react"
],
"rules": {
"react/no-is-mounted": "error"
}
}Biome does not have this rule.
Enforce ES5 or ES6 class for returning value in render function
Disallow variables used in JSX to be incorrectly marked as unused
Disallow direct mutation of this.state