Skip to content

Latest commit

 

History

History
84 lines (57 loc) · 1.77 KB

no-component-will-mount.md

File metadata and controls

84 lines (57 loc) · 1.77 KB
title
no-component-will-mount

Full Name in eslint-plugin-react-x

react-x/no-component-will-mount

Full Name in @eslint-react/eslint-plugin

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

Features

🔄

Presets

  • x
  • recommended
  • recommended-typescript
  • recommended-type-checked

Description

Replaces usages of componentWillMount with UNSAFE_componentWillMount.

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

Examples

Before

import React from "react";

interface MyComponentProps {
  name: string;
}

class MyComponent extends React.Component<MyComponentProps> {
  componentWillMount() {
    // ...
  }
}

After

import React from "react";

interface MyComponentProps {
  name: string;
}

class MyComponent extends React.Component<MyComponentProps> {
  UNSAFE_componentWillMount() {
    // ...
  }
}

Implementation

Further Reading


See Also