# Interface NewLifecycle<P, S, SS>

interface NewLifecycle<P, S, SS> {
componentDidUpdate?(prevProps, prevState, snapshot?): void;
getSnapshotBeforeUpdate?(prevProps, prevState): SS;
}

#### Type Parameters

- P
- S
- SS

#### Hierarchy (view full)

- NewLifecycle
  - ComponentLifecycle

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

#####
Index

### Methods

componentDidUpdate?
getSnapshotBeforeUpdate?

## Methods

### `Optional` componentDidUpdate

- componentDidUpdate(prevProps, prevState, snapshot?): void

- Called immediately after updating occurs. Not called for the initial render.

  The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.

  #### Parameters

  - prevProps: Readonly<P>
  - prevState: Readonly<S>
  - `Optional` snapshot: SS

  #### Returns void

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

### `Optional` getSnapshotBeforeUpdate

- getSnapshotBeforeUpdate(prevProps, prevState): SS

- Runs before React applies the result of render to the document, and returns an object to be given to componentDidUpdate. Useful for saving things such as scroll position before render causes changes to it.

  Note: the presence of this method prevents any of the deprecated lifecycle events from running.

  #### Parameters

  - prevProps: Readonly<P>
  - prevState: Readonly<S>

  #### Returns SS

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