TinyBase logoTinyBase

useHasSlice

The useHasSlice primitive returns a boolean indicating whether a given Slice exists in an Index, and registers a listener so that any changes to that result will cause an update.

useHasSlice(
  indexId: MaybeAccessor<string>,
  sliceId: MaybeAccessor<string>,
  indexesOrIndexesId?: MaybeAccessor<undefined | IndexesOrIndexesId>,
): Accessor<boolean>
TypeDescription
indexIdMaybeAccessor<string>

The Id of a possible Index in the Indexes object.

sliceIdMaybeAccessor<string>

The Id of a possible Slice in the Index.

indexesOrIndexesId?MaybeAccessor<undefined | IndexesOrIndexesId>

The Indexes object to be accessed: omit for the default context Indexes object, provide an Id for a named context Indexes object, or provide an explicit reference.

returnsAccessor<boolean>

Whether a Slice with that Id exists.

This primitive follows the same Indexes object resolution rules as the useSliceIds primitive.

Since

v9.1.0