> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# Function: memo()

## Call Signature

> **memo**\<`P` _extends_ `object`>(`Component`: `FunctionComponent`\<`P`>, `propsAreEqual?`: (`prevProps`: `Readonly`\<`P`>, `nextProps`: `Readonly`\<`P`>) => `boolean`): `NamedExoticComponent`\<`P`>

让你在组件的 props 未变化时跳过重新渲染。

### Type Parameters

| Type Parameter         |
| ---------------------- |
| `P` _extends_ `object` |

### Parameters

| Parameter        | Type                                                                        | Description           |
| ---------------- | --------------------------------------------------------------------------- | --------------------- |
| `Component`      | `FunctionComponent`\<`P`>                                                   | 要进行 memoize 的组件。      |
| `propsAreEqual?` | (`prevProps`: `Readonly`\<`P`>, `nextProps`: `Readonly`\<`P`>) => `boolean` | 用于判断 props 是否发生变化的函数。 |

### Returns

`NamedExoticComponent`\<`P`>

### See

[React Docs](https://react.dev/reference/react/memo)

### Example

```tsx
import { memo } from 'react';

const SomeComponent = memo(function SomeComponent(props: { foo: string }) {
  // ...
});
```

## Call Signature

> **memo**\<`T` _extends_ `ComponentType`\<`any`>>(`Component`: `T`, `propsAreEqual?`: (`prevProps`: `Readonly`\<`ComponentProps`\<`T`>>, `nextProps`: `Readonly`\<`ComponentProps`\<`T`>>) => `boolean`): `MemoExoticComponent`\<`T`>

让你在组件的 props 未变化时跳过重新渲染。

### Type Parameters

| Type Parameter                        |
| ------------------------------------- |
| `T` _extends_ `ComponentType`\<`any`> |

### Parameters

| Parameter        | Type                                                                                                              | Description           |
| ---------------- | ----------------------------------------------------------------------------------------------------------------- | --------------------- |
| `Component`      | `T`                                                                                                               | 要进行 memoize 的组件。      |
| `propsAreEqual?` | (`prevProps`: `Readonly`\<`ComponentProps`\<`T`>>, `nextProps`: `Readonly`\<`ComponentProps`\<`T`>>) => `boolean` | 用于判断 props 是否发生变化的函数。 |

### Returns

`MemoExoticComponent`\<`T`>

### See

[React Docs](https://react.dev/reference/react/memo)

### Example

```tsx
import { memo } from 'react';

const SomeComponent = memo(function SomeComponent(props: { foo: string }) {
  // ...
});
```
