logoESLint React
Rules

no-component-will-receive-props

Replaces usage of 'componentWillReceiveProps' with 'UNSAFE_componentWillReceiveProps'.

Full Name in eslint-plugin-react-x

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

Full Name in @eslint-react/eslint-plugin

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

Features

🔄

Presets

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

Rule Details

This API was renamed from componentWillReceiveProps to UNSAFE_componentWillReceiveProps. The old name has been deprecated. In a future major version of React, only the new name will work.

Common Violations

Invalid

import React from "react";

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

Valid

import React from "react";

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

Resources

Further Reading

On this page