@knowmax/genericlist-core
Version:
Knowmax Generic list with basic CRUD support without any user interface implementation.
15 lines (14 loc) • 953 B
TypeScript
import type { DependencyList } from "react";
import { GenericList } from '.';
import type { IGenericListConfiguration } from '.';
/**
* Generic hook for specified type and configuration. Attempts to cache lists using endpoint as key.
* Automatically loads data, updates token and selected application.
*
* @param configuration - List configuration including endpoint and other settings
* @param autoLoad - Whether to automatically load data when the list is created or dependencies change
* @param cache - Whether to use caching. When true, lists are cached by endpoint/id key
* @param dependencies - Optional custom dependencies. When any of these change, the cached list (if any)
* will be removed and a fresh list instance will be created
*/
export declare const useList: <T extends object>(configuration: IGenericListConfiguration, autoLoad?: boolean, cache?: boolean, dependencies?: DependencyList) => GenericList<T>;