# Interface ComponentSpec<P, S>

#### Deprecated

#### See

Mixins Considered Harmful

interface ComponentSpec<P, S> {
childContextTypes?: ValidationMap<any>;
contextTypes?: ValidationMap<any>;
displayName?: string;
mixins?: Mixin<P, S>[];
propTypes?: ValidationMap<any>;
statics?: {
[key: string]: any;
};
UNSAFE_componentWillMount?(): void;
UNSAFE_componentWillReceiveProps?(nextProps, nextContext): void;
UNSAFE_componentWillUpdate?(nextProps, nextState, nextContext): void;
componentDidCatch?(error, errorInfo): void;
componentDidMount?(): void;
componentDidUpdate?(prevProps, prevState, snapshot?): void;
componentWillMount?(): void;
componentWillReceiveProps?(nextProps, nextContext): void;
componentWillUnmount?(): void;
componentWillUpdate?(nextProps, nextState, nextContext): void;
getDefaultProps?(): P;
getInitialState?(): S;
getSnapshotBeforeUpdate?(prevProps, prevState): any;
render(): ReactNode;
shouldComponentUpdate?(nextProps, nextState, nextContext): boolean;
[propertyName: string]: any;
}

#### Type Parameters

- P
- S

#### Hierarchy (view full)

- Mixin<P, S>
  - ComponentSpec

#### Indexable

[propertyName: string]: any

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

#####
Index

### Properties

childContextTypes?
contextTypes?
displayName?
mixins?
propTypes?
statics?

### Methods

UNSAFE_componentWillMount?
UNSAFE_componentWillReceiveProps?
UNSAFE_componentWillUpdate?
componentDidCatch?
componentDidMount?
componentDidUpdate?
componentWillMount?
componentWillReceiveProps?
componentWillUnmount?
componentWillUpdate?
getDefaultProps?
getInitialState?
getSnapshotBeforeUpdate?
render
shouldComponentUpdate?

## Properties

### `Optional` childContextTypes

childContextTypes?: ValidationMap<any>

Inherited from Mixin.childContextTypes

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

### `Optional` contextTypes

contextTypes?: ValidationMap<any>

Inherited from Mixin.contextTypes

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

### `Optional` displayName

displayName?: string

Inherited from Mixin.displayName

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

### `Optional` mixins

mixins?: Mixin<P, S>[]

Inherited from Mixin.mixins

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

### `Optional` propTypes

propTypes?: ValidationMap<any>

Inherited from Mixin.propTypes

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

### `Optional` statics

statics?: {
[key: string]: any;
}

#### Type declaration

- ##### [key: string]: any

Inherited from Mixin.statics

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

## 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

  Inherited from Mixin.UNSAFE_componentWillMount

  - 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

  Inherited from Mixin.UNSAFE_componentWillReceiveProps

  - 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

  Inherited from Mixin.UNSAFE_componentWillUpdate

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

### `Optional` componentDidCatch

- componentDidCatch(error, errorInfo): void

- Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.

  #### Parameters

  - error: Error
  - errorInfo: ErrorInfo

  #### Returns void

  Inherited from Mixin.componentDidCatch

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

### `Optional` componentDidMount

- componentDidMount(): void

- Called immediately after a component is mounted. Setting state here will trigger re-rendering.

  #### Returns void

  Inherited from Mixin.componentDidMount

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

### `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: any

  #### Returns void

  Inherited from Mixin.componentDidUpdate

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

### `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

  Inherited from Mixin.componentWillMount

  - 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

  Inherited from Mixin.componentWillReceiveProps

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

### `Optional` componentWillUnmount

- componentWillUnmount(): void

- Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any DOM elements created in `componentDidMount`.

  #### Returns void

  Inherited from Mixin.componentWillUnmount

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

### `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

  Inherited from Mixin.componentWillUpdate

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

### `Optional` getDefaultProps

- getDefaultProps(): P

- #### Returns P

  Inherited from Mixin.getDefaultProps

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

### `Optional` getInitialState

- getInitialState(): S

- #### Returns S

  Inherited from Mixin.getInitialState

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

### `Optional` getSnapshotBeforeUpdate

- getSnapshotBeforeUpdate(prevProps, prevState): any

- 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 any

  Inherited from Mixin.getSnapshotBeforeUpdate

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

### render

- render(): ReactNode

- #### Returns ReactNode

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

### `Optional` shouldComponentUpdate

- shouldComponentUpdate(nextProps, nextState, nextContext): boolean

- Called to determine whether the change in props and state should trigger a re-render.

  `Component` always returns true. `PureComponent` implements a shallow comparison on props and state and returns true if any props or states have changed.

  If false is returned, Component.render, `componentWillUpdate` and `componentDidUpdate` will not be called.

  #### Parameters

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

  #### Returns boolean

  Inherited from Mixin.shouldComponentUpdate

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