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.
import { usePerson } from "@/lib/ouro/use-person";Example
const photo = usePerson(photos, message.authorId);
const name = usePerson(names, message.authorId);
return <Avatar name={name.value ?? message.authorName} src={photo.value} />;Parameters
cache- Type:
PeopleCache<T> id- Type:
string | null | undefined
Returns
PersonEntry<T>
