useField ​
Hook to manage a form field
typescript
import { useField } from '@siberiacancode/reactuse';
Usage ​
typescript
const { register, getValue, setValue, reset, dirty, error, setError, clearError, touched, focus, watch } = useField();
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
params.initialValue? | Value | - | Initial value |
params.initialTouched? | boolean | false | Initial touched state |
params.autoFocus? | boolean | false | Auto focus |
params.validateOnChange? | boolean | false | Validate on change |
params.validateOnBlur? | boolean | false | Validate on blur |
params.validateOnMount? | boolean | false | Validate on mount |