logoESLint React
Rules

no-unsafe-component-will-receive-props

Warns about the use of `UNSAFE_componentWillReceiveProps` in class components.

Full Name in eslint-plugin-react-x

react-x/no-unsafe-component-will-receive-props

Full Name in @eslint-react/eslint-plugin

@eslint-react/no-unsafe-component-will-receive-props

Presets

x recommended recommended-typescript recommended-type-checked strict strict-typescript strict-type-checked

Rule Details

Using unsafe lifecycle methods like UNSAFE_componentWillReceiveProps makes your component's behavior less predictable and more likely to cause bugs.

Common Violations

Invalid

import React from "react";

class MyComponent extends React.Component {
  UNSAFE_componentWillReceiveProps() {
    // ...
  }
}

Resources

Further Reading


See Also

On this page