logoESLint React
Rules

no-component-will-update

Replaces usage of 'componentWillUpdate' with 'UNSAFE_componentWillUpdate'.

Full Name in eslint-plugin-react-x

react-x/no-component-will-update

Full Name in @eslint-react/eslint-plugin

@eslint-react/no-component-will-update

Features

🔄

Presets

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

Rule Details

This API was renamed from componentWillUpdate to UNSAFE_componentWillUpdate. The old name is 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 {
  componentWillUpdate() {
    // ...
  }
}

Valid

import React from "react";

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

Resources

Further Reading

On this page