Rules
no-unsafe-component-will-mount
Full Name in eslint-plugin-react-x
react-x/no-unsafe-component-will-mountFull Name in @eslint-react/eslint-plugin
@eslint-react/no-unsafe-component-will-mountPresets
- x
- recommended
- recommended-typescript
- recommended-type-checked
Description
Warns the usage of UNSAFE_componentWillMount in class components.
Using unsafe lifecycle methods like UNSAFE_componentWillMount 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_componentWillMount() {
    // ...
  }
}Implementation
See Also
- no-unsafe-component-will-receive-props
 Prevents usage of- UNSAFE_componentWillReceivePropsin class components.
- no-unsafe-component-will-update
 Prevents usage of- UNSAFE_componentWillUpdatein class components.