Migration from v2 to v3
See the following steps to migrate from Rapid Form v2 to v3.
Import the useRapidForm
hook from rapid-form
package.
import useRapidForm from 'rapid-form';
import { useRapidForm } from 'rapid-form';
Replace the handleSubmit
, reset
, and submitValidation
functions with the refValidation
function.
const { validation, handleSubmit, reset, submitValidation } = useRapidForm();
const { refValidation } = useRapidForm();
Use the refValidation
function to validate the form fields.
<input name="username" ref={validation} required />
<form ref={(ref) => refValidation(ref)}> <input name="username" required /></form>