monday-ui-react-core
Version:
Official monday.com UI resources for application development in React.js
19 lines (18 loc) • 749 B
TypeScript
import { ChangeEvent, Dispatch, SetStateAction } from "react";
export type UseDebounceResult = {
inputValue: string;
onEventChanged: (event: ChangeEvent<Partial<HTMLInputElement> | Partial<HTMLTextAreaElement>>) => void;
clearValue: () => void;
updateValue: Dispatch<SetStateAction<string>>;
};
export default function useDebounceEvent({ delay, onChange, initialStateValue, trim }: {
onChange: (value: string) => void;
initialStateValue?: string;
delay?: number;
trim?: boolean;
}): {
inputValue: string;
onEventChanged: (event: ChangeEvent<Partial<HTMLInputElement> | Partial<HTMLTextAreaElement>>) => void;
clearValue: () => void;
updateValue: Dispatch<SetStateAction<string>>;
};