UNPKG

@rocket.chat/fuselage-hooks

Version:

React hooks for Fuselage, Rocket.Chat's design system and UI toolkit

22 lines 1.06 kB
/** * Hook that lets you extract non-reactive logic into an *effect event*. * * An effect event is a function that is a part of an effect logic, but it behaves a lot more like * an event handler. The logic inside it is not reactive, and it always “sees” the latest values of * your props and state. * * @param fn - the mutable callback * @returns a stable callback * @public */ export declare const useEffectEvent: <TFunction extends Function>(fn: TFunction) => (...args: TFunction extends (...args: infer P) => any ? P : never) => TFunction extends (...args: any) => infer T ? T : never; /** * Hook to create a stable callback from a mutable one. * * @deprecated use {@link useEffectEvent} instead * @param fn - the mutable callback * @returns a stable callback * @public */ export declare const useMutableCallback: <TFunction extends Function>(fn: TFunction) => (...args: TFunction extends (...args: infer P) => any ? P : never) => TFunction extends (...args: any) => infer T ? T : never; //# sourceMappingURL=useEffectEvent.d.ts.map