Please note that this hook maintains a global state. All instances of this hook will return the same array of documents. This means that if you call
loadAll, the loaded documents will be populated across all instances of the hook.
options(object) Options for the hook. Optional
options.sortBy('createdAt' | 'updatedAt' | 'unreadCount') How to sort the documents. Defaults to 'updatedAt'
options.initialLoad(number | 'all') How many documents to load when the the hook is first mounted. Pass "all" to load all the documents. If not provided, no documents will be loaded until a loader function is manually called.
Returns an object with the following properties:
loadMore((count: number) => Promise<void>) A function that can be called to load more documents. Accepts a number as as parameter which determines how many more documents to load.
loadAll(() => Promise<void>) A function that can be called to load all a users documents
loading(boolean) A boolean representing if documents are currently being loaded or not
documents(Document) An array of loaded documents