Releases: react-hook-form/resolvers
Releases · react-hook-form/resolvers
Version 1.3.1
esm support to fix bundler incompatibility (#95)
Version 1.3.0
Support Yup ^0.32.0 (#92)
Version 1.2.0
vestResolver (#82)
import * as React from 'react';
import { useForm } from 'react-hook-form';
import { vestResolver } from '@hookform/resolvers/vest';
import vest, { test, enforce } from 'vest';
const validationSuite = vest.create((data = {}) => {
test('username', 'Username is required', () => {
enforce(data.username).isNotEmpty();
});
test('username', 'Must be longer than 3 chars', () => {
enforce(data.username).longerThan(3);
});
test('password', 'Password is required', () => {
enforce(data.password).isNotEmpty();
});
test('password', 'Password must be at least 5 chars', () => {
enforce(data.password).longerThanOrEquals(5);
});
test('password', 'Password must contain a digit', () => {
enforce(data.password).matches(/[0-9]/);
});
test('password', 'Password must contain a symbol', () => {
enforce(data.password).matches(/[^A-Za-z0-9]/);
});
});
const App = () => {
const { register, handleSubmit, errors } = useForm({
resolver: vestResolver(validationSuite),
});
return (
<form onSubmit={handleSubmit((data) => console.log(data))}>
<input type="text" name="username" ref={register} />
<input type="text" name="password" ref={register} />
<input type="submit" />
</form>
);
};
Version 1.1.2
fix: superstruct filename typo (#89)
Version 1.1.1
fix: IE11 build (#85)
Version 1.1.0
Update Superstruct version (#83)
Version 1.0.1
Version 1.0.0
🎉 Resolver version 1.0.0 is LIVE.
Version v1.0.0-rc.2
🎉 Zod resolver
import React from 'react';
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import * as z from 'zod';
const schema = z.object({
username: z.string(),
});
const App = () => {
const { register, handleSubmit } = useForm({
resolver: zodResolver(schema),
});
return (
<form onSubmit={handleSubmit((d) => console.log(d))}>
<input name="name" ref={register} />
<input name="age" type="number" ref={register} />
<input type="submit" />
</form>
);
};
v1.0.0-rc.1
Thanks for the amazing work that @jorisre has done ❤️ -> #60.
We finally have a solution for the modules import issue around TypeScripts -> #20.
Breaking changes
- import { yupResolver } from '@hookform/resolvers';
- import { joiResolver } from '@hookform/resolvers';
- import { superstructResolver } from '@hookform/resolvers';
+ import { yupResolver } from '@hookform/resolvers/yup';
+ import { joiResolver } from '@hookform/resolvers/joi';
+ import { superstructResolver } from '@hookform/resolvers/superstruct';