TinyBase logoTinyBase β

useHasIndex

The useHasIndex hook returns a boolean indicating whether a given Index exists in the Indexes object, and registers a listener so that any changes to that result will cause a re-render.

useHasIndex(
  indexId: string,
  indexesOrIndexesId?: IndexesOrIndexesId,
): boolean
TypeDescription
indexIdstring

The Id of a possible Index in the Indexes object.

indexesOrIndexesId?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.

returnsboolean

Whether an Index with that Id exists.

This hook follows the same Indexes object resolution rules as the useIndexIds hook.

Since

v9.1.0