跳到主要内容

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

ParameterTypeDescription
EntityTypeTThe entity class
optionsUseOptions<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' } });