useFindOne()
function useFindOne<T>(EntityType, options): RxDBResource<InstanceType<T> | undefined>;
Defined in: hooks.ts:172
Find one entity matching the criteria
Type Parameters
| Type Parameter |
|---|
T extends EntityType |
Parameters
| Parameter | Type | Description |
|---|---|---|
EntityType | T | The entity class |
options | UseOptions<EntityStaticType<T, "findOneOptions">> | Query options (where clause, sort, etc.) |
Returns
RxDBResource<InstanceType<T> | undefined>
A resource object containing the entity
Example
const { value: user } = useFindOne(User, { where: { name: 'Alice' } });