-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Ashish Uttam edited this page Apr 22, 2021
·
17 revisions
A simple hook for your react forms.
You can use the hook to simply create the state of your input control or build the whole form using the hook. Following example shows creating a single field for an input control -
import React from "react";
import { useForm } from "react-form-use";
const App = () => {
const {
fields: [myField],
} = useForm([{ name: "myField" }]);
return <input value={myField.value} onChange={myField.handleChange} />;
};
Check API page for more details.
- Hello World Example - Basic Usage
- Simple Form Example - Field validation, Custom error message, Form reset, Form submit
-
Transform Value Example - Modify the value onChange using the
transform
callback - Select Element Example - Working with single and multiple Select elements