Skip to content

Basic Concepts ​

This page will introduce some basic concepts in Ez Form.

Form Instance ​

FormInstance is an object that contains the form's data and methods.

You can get it from useForm.

tsx
import { useForm } from "@ez-kits/form-react";

const form = useForm({
	// form options go here
});

Field Instance ​

FieldInstance is an object that contains the field's data and methods. This is the way to get it.

tsx
import { useField } from "@ez-kits/form-react";

const field = useField({
	name: "username"
});

WARNING

useField uses FormInstance, provided by form.Form. So, you have to use useField in component under form.Form or useForm.

Field Array Instance ​

FieldArrayInstance is an object that contains the field array's data and methods. You can get it just like FieldInstance.

tsx
import { useFieldArray } from "@ez-kits/form-react";

const field = useFieldArray({
	name: "list"
});

WARNING

useFieldArray uses FormInstance, provided by form.Form. So, you have to use useFieldArray in component under form.Form or useForm.

Ez Form