UNPKG

snippet-hook

Version:

A simple and reusable custom hook for managing form state in React. The useForm hook allows you to easily manage form data, handle input changes, and reset the form state.

7 lines (6 loc) 270 B
interface UseFormProps<T> { initialValues: T; } type ChangeEvent = React.ChangeEvent<HTMLInputElement>; declare const useForm: <T extends Record<string, any>>({ initialValues, }: UseFormProps<T>) => [T, (event: ChangeEvent) => void, () => void]; export { useForm };