Description:
We currently use the useForm hook across the Hexabot frontend, often repeating the same logic for registering fields, applying validation rules, and managing default values. To improve both developer experience and type safety, I propose introducing two new helper hooks:
🔧 Proposed Enhancement
-
useStrictForm:
A strongly typed version of useForm that enforces field names and types from a provided schema/interface. It can also:
- Accept default values
- Accept validation rules
- Improve intellisense and reduce boilerplate
-
useStrictRegister:
A wrapper for register that only allows registering known, typed fields. This will prevent accidental field name typos and help maintain consistency across forms.
✅ Benefits
- Centralized logic for default values and validation rules
- Stronger TypeScript support with clear typing for field names and values
- Cleaner code in components using forms
- Easier unit testing and reusability