Skip to content

Instantly share code, notes, and snippets.

@akshay-nm
Created May 1, 2021 09:54
Show Gist options
  • Save akshay-nm/a38e97372249dbc3893d4034cb1cfae9 to your computer and use it in GitHub Desktop.
Save akshay-nm/a38e97372249dbc3893d4034cb1cfae9 to your computer and use it in GitHub Desktop.
use-form-state login form call
const {
isValid: formIsValid,
isValidating,
resetForm,
email,
showEmailWarning,
onEmailChange,
password,
showPasswordWarning,
onPasswordChange
} = useFormState({
states: [
{
name: 'email',
default: '',
defaultIsValid: false,
mustBeValid: true,
validator: () => true
},
{
name: 'password',
default: '',
defaultIsValid: false,
mustBeValid: true,
validator: (val) => val.length > 5
}
],
debug: false
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment