<!-- Generated by scripts/gen-docs.mts from the JSDoc in registry/. Do not edit; run `pnpm run docs`. -->

# usePerson

One person from a cache made with `createPeopleCache`, for a component that shows them, such as an avatar or a message's author: their entry, read while the component shows it and again whenever it runs out. Pass `null` or `undefined` while the id is not known; the entry is then `unknown`, and nothing is read. The server renders the `unknown` entry, and so does hydration, before the cache's entry replaces it.

```tsx
import { usePerson } from "@/lib/ouro/use-person";
```

## Example

```tsx
const photo = usePerson(photos, message.authorId);
const name = usePerson(names, message.authorId);
return <Avatar name={name.value ?? message.authorName} src={photo.value} />;
```

## Parameters

| Parameter | Type |
| --- | --- |
| `cache` | `PeopleCache<T>` |
| `id` | `string \| null \| undefined` |

## Returns

`PersonEntry<T>`
