> 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: useSyncExternalStore()

> **useSyncExternalStore**\<`Snapshot`>(`subscribe`: (`onStoreChange`: () => `void`) => () => `void`, `getSnapshot`: () => `Snapshot`, `getServerSnapshot?`: () => `Snapshot`): `Snapshot`

## Type Parameters

| Type Parameter |
| -------------- |
| `Snapshot`     |

## Parameters

| Parameter            | Type                                            |
| -------------------- | ----------------------------------------------- |
| `subscribe`          | (`onStoreChange`: () => `void`) => () => `void` |
| `getSnapshot`        | () => `Snapshot`                                |
| `getServerSnapshot?` | () => `Snapshot`                                |

## Returns

`Snapshot`

## See

[https://github.com/reactwg/react-18/discussions/86](https://github.com/reactwg/react-18/discussions/86)
