@kwiz/fluentui
Version:
KWIZ common controls for FluentUI
19 lines (18 loc) • 668 B
TypeScript
/**
* Call at the beginning of a useEffect, check after all your promises finished before applying results to state.
* You must keep the same name for each useEffect
* const {getConcurrency} = useIsConcurrent();
* useEffect(()=>{
* const c = getConcurrency('loading data');
* const result = await someSlowPromise();
* if( c.isCurrent() ) setData(result);
* },[]);
*/
export declare function useIsConcurrent(): {
isCurrent: (effectName: string, value: number) => boolean;
/** effectName must be unique for each useEffect */
getConcurrency: (effectName: string) => {
value: number;
isCurrent: () => boolean;
};
};