Skip to content

Releases: react-hook-form/resolvers

Version 1.3.1

30 Dec 22:55
181271d
Compare
Choose a tag to compare

esm support to fix bundler incompatibility (#95)

Version 1.3.0

29 Dec 07:51
Compare
Choose a tag to compare

Support Yup ^0.32.0 (#92)

Version 1.2.0

14 Dec 22:22
Compare
Choose a tag to compare

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

09 Dec 08:09
Compare
Choose a tag to compare

fix: superstruct filename typo (#89)

Version 1.1.1

30 Nov 22:58
Compare
Choose a tag to compare

fix: IE11 build (#85)

Version 1.1.0

30 Nov 07:36
02814b0
Compare
Choose a tag to compare

Update Superstruct version (#83)

Version 1.0.1

06 Nov 22:39
Compare
Choose a tag to compare
  • build: add TS declaration file to ie11 build (#72)
  • Use right version of react-hook-form for ie11 bundle (#68)

Version 1.0.0

03 Oct 23:25
Compare
Choose a tag to compare

🎉 Resolver version 1.0.0 is LIVE.

Version v1.0.0-rc.2

24 Sep 05:19
Compare
Choose a tag to compare

🎉 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

23 Sep 05:25
Compare
Choose a tag to compare

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';