react-hook-form-persist
Version:
Persist and populate react-hook-form form using storage of your choice
19 lines (16 loc) • 592 B
TypeScript
import { SetFieldValue } from 'react-hook-form';
interface FormPersistConfig {
storage?: Storage;
watch: (names?: string | string[]) => any;
setValue: SetFieldValue<any>;
exclude?: string[];
onDataRestored?: (data: any) => void;
validate?: boolean;
dirty?: boolean;
onTimeout?: () => void;
timeout?: number;
}
declare const useFormPersist: (name: string, { storage, watch, setValue, exclude, onDataRestored, validate, dirty, onTimeout, timeout }: FormPersistConfig) => {
clear: () => void;
};
export { FormPersistConfig, useFormPersist as default };