Tracking
To access your inputs data outside a component, you need to create it outside. The result inherit every method available on the FORM object, and have two new property
- useValues() a hook to sync a component with your inputs values.
- isValid() a method to check the validity of your inputs.
Tracking tool
Import trackInputs from aio-inputs package
import{trackInputs}from"aio-inputs"
Copied
Create your inputs hook
trackInputs() works exactly like useInputs(). The difference is that trackInputs() return a useInputs() that inherit every method available on the FORM object.
constmyCustomInputs=trackInputs(["name","gender"])
Copied
Use your custom inputs hook
const[myInputs, form]=myCustomInputs()
Copied
Use values
useValues() is a hook for sharing your inputs values in real-time with other components.
// useValues
myCustomInputs.useValues()
Copied
IsValid
isValid() is a method to check the validity of your inputs.
// isValid
myCustomInputs.isValid()
Copied
Hit next to know more about all available PROPERTIES