next-era
Version:
Welcome to **Next Era**! A comprehensive library designed to supercharge your **Next.js** applications with powerful utilities and significant performance optimizations. Build faster, more efficient, and feature-rich Next.js projects with ease.
11 lines (10 loc) • 756 B
TypeScript
import { UseFormChangeHandlerType } from "./lib/definitions.js";
/**
* Hook to handle form change event.
* Specific for checkbox change event. since checkbox is multichoice checker, the data's passing to handler will be array of string joined by ','.
* Example: 3 checkboxes with same name 'animal', have 3 diffence values: 'chicken', 'cow', 'duck', in one group, the handler will be received data => 'chicken,cow,duck' instead of 'chicken' or 'cow' or 'duck' by each change event.
* @param handler handler function to handle form change event
* @returns onChange event handler
*/
declare const useFormChange: (handler: (data: UseFormChangeHandlerType) => void) => ((event: React.FormEvent<HTMLFormElement>) => void)[];
export default useFormChange;