跳到主要内容

useFindOneOrFail()

function useFindOneOrFail<T>(EntityType, options): RxDBResource<InstanceType<T> | undefined>;

Defined in: rxdb-react/src/hooks.ts:204

查找第一个匹配实体,仓库未找到时把错误写入资源。

Type Parameters​

Type Parameter
T extends EntityType

Parameters​

ParameterTypeDescription
EntityTypeT实体类型。
optionsUseOptions<EntityStaticType<T, "findOneOrFailOptions">>findOneOrFail 查询选项或幂等 factory。

Returns​

RxDBResource<InstanceType<T> | undefined>

未匹配时 error 有值且 hasValue 为 false 的查询资源。