Rules
no-unsafe-component-will-receive-props
Full Name in eslint-plugin-react-x
react-x/no-unsafe-component-will-receive-propsFull Name in @eslint-react/eslint-plugin
@eslint-react/no-unsafe-component-will-receive-propsPresets
xrecommendedrecommended-typescriptrecommended-type-checked
Description
Warns the usage of UNSAFE_componentWillReceiveProps in class components.
Using unsafe lifecycle methods like UNSAFE_componentWillReceiveProps makes your component's behavior less predictable and are more likely to cause bugs.
Examples
Failing
import React from "react";
class MyComponent extends React.Component {
UNSAFE_componentWillReceiveProps() {
// ...
}
}Implementation
See Also
no-unsafe-component-will-mount
Prevents usage ofUNSAFE_componentWillMountin class components.no-unsafe-component-will-update
Prevents usage ofUNSAFE_componentWillUpdatein class components.