cyl-hooks-tools
Version:
基于react上下文实现的权限管理
7 lines (3 loc) • 343 B
TypeScript
import { IContext,IContextInstance } from "../index";
export function useCollector<T, C>(collection: C[], mapper: (elem: C) => T): T[]
export function useApiCollectionFetcher<M extends IContext<IContextInstance>,T, C, R>(api:M, collection: C[], mapper: (elem: C) => T, fetcher: (context:M, ids: T[]) => Promise<R[]>): [R[], boolean, Error]