Form State Management with useReducer
A reusable, type-safe React hook for managing complex form state (values, errors, touched) using useReducer.
useFormReducer is a lightweight, predictable form state manager built on useReducer. It separates concerns cleanly: formState.values, formState.errors, and formState.touched are always available and updated immutably. Use updateField, setError, and setTouched to imperatively control state per field — ideal for dynamic or deeply nested forms. Call resetForm() to restore initial values (or pass new ones). No external dependencies; works out of the box with TypeScript (add JSDoc or types if needed in your project). Note: This hook doesn’t include validation logic — pair it with useFormValidation or your own validator for full form handling.