# Interface DeprecatedLifecycle<P, S>

interface DeprecatedLifecycle<P, S> {
UNSAFE_componentWillMount?(): void;
UNSAFE_componentWillReceiveProps?(nextProps, nextContext): void;
UNSAFE_componentWillUpdate?(nextProps, nextState, nextContext): void;
componentWillMount?(): void;
componentWillReceiveProps?(nextProps, nextContext): void;
componentWillUpdate?(nextProps, nextState, nextContext): void;
}

#### Type Parameters

- P
- S

#### Hierarchy (view full)

- DeprecatedLifecycle
  - ComponentLifecycle

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1429

#####
Index

### Methods

UNSAFE_componentWillMount?
UNSAFE_componentWillReceiveProps?
UNSAFE_componentWillUpdate?
componentWillMount?
componentWillReceiveProps?
componentWillUpdate?

## Methods

### `Optional` UNSAFE_componentWillMount

- UNSAFE_componentWillMount(): void

- Called immediately before mounting occurs, and before Component.render. Avoid introducing any side-effects or subscriptions in this method.

  This method will not stop working in React 17.

  Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.

  #### Returns void

  #### Deprecated

  16.3, use componentDidMount or the constructor instead

  #### See

  - https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state
  - https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1457

### `Optional` UNSAFE_componentWillReceiveProps

- UNSAFE_componentWillReceiveProps(nextProps, nextContext): void

- Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.

  Calling Component.setState generally does not trigger this method.

  This method will not stop working in React 17.

  Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.

  #### Parameters

  - nextProps: Readonly<P>
  - nextContext: any

  #### Returns void

  #### Deprecated

  16.3, use static getDerivedStateFromProps instead

  #### See

  - https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props
  - https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1491

### `Optional` UNSAFE_componentWillUpdate

- UNSAFE_componentWillUpdate(nextProps, nextState, nextContext): void

- Called immediately before rendering when new props or state is received. Not called for the initial render.

  Note: You cannot call Component.setState here.

  This method will not stop working in React 17.

  Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.

  #### Parameters

  - nextProps: Readonly<P>
  - nextState: Readonly<S>
  - nextContext: any

  #### Returns void

  #### Deprecated

  16.3, use getSnapshotBeforeUpdate instead

  #### See

  - https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update
  - https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1521

### `Optional` componentWillMount

- componentWillMount(): void

- Called immediately before mounting occurs, and before Component.render. Avoid introducing any side-effects or subscriptions in this method.

  Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.

  #### Returns void

  #### Deprecated

  16.3, use componentDidMount or the constructor instead; will stop working in React 17

  #### See

  - https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state
  - https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1442

### `Optional` componentWillReceiveProps

- componentWillReceiveProps(nextProps, nextContext): void

- Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.

  Calling Component.setState generally does not trigger this method.

  Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.

  #### Parameters

  - nextProps: Readonly<P>
  - nextContext: any

  #### Returns void

  #### Deprecated

  16.3, use static getDerivedStateFromProps instead; will stop working in React 17

  #### See

  - https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props
  - https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1473

### `Optional` componentWillUpdate

- componentWillUpdate(nextProps, nextState, nextContext): void

- Called immediately before rendering when new props or state is received. Not called for the initial render.

  Note: You cannot call Component.setState here.

  Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.

  #### Parameters

  - nextProps: Readonly<P>
  - nextState: Readonly<S>
  - nextContext: any

  #### Returns void

  #### Deprecated

  16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17

  #### See

  - https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update
  - https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1505