-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Labels
Description
This is a feature request to allow the validate()
function to return a Promise
for the validation result. A common use case is to perform an API request to check whether a username is unique in the database.
export default function SignUpForm() {
const [state, { text }] = useFormState();
return (
<input
{...text({
name: 'username',
validate: async (value) => {
const result = await checkUniqueUsername(value);
return result;
},
validateOnBlur: true,
})}
required
/>
);
};
oyeanuj, jfennell-techempower and wswoodruff