
React Hook Form Plus (RHF+) is an enhanced fork of React Hook Form. It is designed to be a drop-in replacement for React Hook Form, so you can use it in your existing projects without any changes.
Quick Start
Installation
npm install @bombillazo/rhf-plus
yarn add @bombillazo/rhf-plus
pnpm add @bombillazo/rhf-plus
Simply replace your React Hook Form import:
// Before
import { useForm } from 'react-hook-form';
// After
import { useForm } from '@bombillazo/rhf-plus';
✨ Enhancements
Major Features
- Imperative form submission - Submit forms programmatically with enhanced control
- Smart “disabled” state - Intelligent field disabling based on form state
- JSX error messages - Render JSX components as error messages
- Controllable “isLoading” state - Manual control over form loading state
- Form metadata - Access additional form information and statistics
- “ScrollIntoView” method on field refs - Automatically scroll to fields with errors
- “Controller” children function - Enhanced controller component with function children
- Form and field “focus” state - Track which fields are currently focused
- Form “isDirtySinceSubmit” state - Detect changes after form submission
- Form “hasBeenSubmitted” state - Track if form has ever been submitted
- Readonly field validation skip - Skip validation for readonly fields
Minor Improvements
- Controller rules update on prop change
- Empty array validation
- Add displayName to “useFormContext”
- Improve “useController” error on missing “control” prop
⚠️ Performance Note
We’ve optimized enhancements and features to minimize the impact on form performance. That said, adding new form states, methods, and data events results in the unavoidable outcome of:
- Increased package size
- Additional form renders