fielder
Version:
A field-first form library for React and React Native
24 lines (23 loc) • 821 B
TypeScript
declare type UseSubmitResponse = {
/** Indicates when async `submit` validation is in progress. */
isValidating: boolean;
/**
* Is set to true immediately upon call of the handleSubmit function.
*
* _Does not imply the form is valid or that submit validation was successful_
**/
hasSubmitted: boolean;
/**
* Wrapper for provided submit function.
*/
handleSubmit: () => void;
};
/**
* Wrapper utility for triggering submission validation.
*
* - Constructs values object to provided submission function
* - Guards submission function until sync/async validation has completed
* - Indicates state of submission
*/
export declare const useSubmit: <T extends Record<string, any>>(handler: (values: T) => void) => UseSubmitResponse;
export {};