TinyBase logoTinyBase β

useHasValue

The useHasValue hook returns a reactive object indicating whether a Value exists in the Store, and registers a listener so that any changes to that result will update .current.

useHasValue(
  valueId: MaybeGetter<string>,
  storeOrStoreId?: MaybeGetter<undefined | StoreOrStoreId>,
): {current: boolean}
TypeDescription
valueIdMaybeGetter<string>

The Id of the Value (or a getter returning it).

storeOrStoreId?MaybeGetter<undefined | StoreOrStoreId>

The Store to use (plain value or getter), or its Id.

returns{current: boolean}

A reactive object with a current boolean property.

Since

v8.1.0