@mmcodemark/fuselage-hooks
Version:
React hooks for Fuselage, Rocket.Chat's design system and UI toolkit
11 lines • 563 B
TypeScript
import type { Dispatch, DispatchWithoutAction } from 'react';
/**
* Hook that wraps pairs of state and dispatcher to provide a new dispatcher
* which can be safe and asynchronically called even after the component unmounted.
*
* @param pair - the state and dispatcher pair which will be patched
* @returns a state value and safe dispatcher pair
* @public
*/
export declare function useSafely<S, D extends DispatchWithoutAction | Dispatch<any>>([state, dispatcher,]: [state: S, dispatch: D]): [state: S, dispatch: D];
//# sourceMappingURL=useSafely.d.ts.map