react-compose-onmount
Version:
A helper function to attach onmount handler to stateless function components
10 lines (9 loc) • 366 B
TypeScript
type Callback<P> = ((props: P) => void) | void;
type Options = {
onMount: string | undefined,
onUnmount: string | undefined,
};
export type ComposeWithOnMount =
<P extends {}>(onMount: Callback<P>, onUnmount?: Callback<P>, options?: Options) =>
(base: React.ComponentType<P>) => React.ComponentType<P>;
export const composeWithOnMount: ComposeWithOnMount;