Skip to content

Releases: react-hook-form/resolvers

v2.9.9

14 Oct 12:24
4afc03b
Compare
Choose a tag to compare

2.9.9 (2022-10-14)

Bug Fixes

v2.9.8

11 Sep 19:09
467b6ac
Compare
Choose a tag to compare

2.9.8 (2022-09-11)

Bug Fixes

v2.9.7

26 Jul 23:36
99703e6
Compare
Choose a tag to compare

2.9.7 (2022-07-26)

Bug Fixes

  • #396 remove unnecessary 'browser' exports to fix Jest integration (#435) (99703e6)

v2.9.6

15 Jul 07:42
928afae
Compare
Choose a tag to compare

2.9.6 (2022-07-15)

Bug Fixes

  • yup: yup wrong import statement assuming default export (#427) (928afae)

v2.9.5

08 Jul 07:47
eebd258
Compare
Choose a tag to compare

2.9.5 (2022-07-08)

Bug Fixes

  • renamed private packages to avoid ambiguity with existing official packages. (#424) (18ae921)

v2.9.4

07 Jul 06:56
fd1b2a7
Compare
Choose a tag to compare

2.9.4 (2022-07-07)

Bug Fixes

v2.9.3

24 Jun 23:38
52a6e07
Compare
Choose a tag to compare

2.9.3 (2022-06-24)

Breaking Change

  • compile error with UnpackNestedValue

BREAKING CHANGE: This change will update package dependency with react-hook-form to 7.33.0 above (52a6e07)

v2.9.2

23 Jun 22:16
7951951
Compare
Choose a tag to compare

2.9.2 (2022-06-23)

Bug Fixes

  • exchange fp-ts/Either over fp-ts/lib/Either (#419) (7951951)

v2.9.1

10 Jun 07:56
115db62
Compare
Choose a tag to compare

2.9.1 (2022-06-10)

Bug Fixes

  • ajv resolver to work with unlimited layers of nesting (#412) (692fe65)

v2.9.0

03 Jun 08:33
0cad904
Compare
Choose a tag to compare

2.9.0 (2022-06-03)

Features

import { useForm } from 'react-hook-form';
import { ajvResolver } from '@hookform/resolvers/ajv';

// must use `minLength: 1` to implement required field
const schema = {
  type: 'object',
  properties: {
    username: {
      type: 'string',
      minLength: 1,
      errorMessage: { minLength: 'username field is required' },
    },
    password: {
      type: 'string',
      minLength: 1,
      errorMessage: { minLength: 'password field is required' },
    },
  },
  required: ['username', 'password'],
  additionalProperties: false,
};

const App = () => {
  const {
    register,
    handleSubmit,
    formState: { errors },
  } = useForm({
    resolver: ajvResolver(schema),
  });

  return (
    <form onSubmit={handleSubmit((data) => console.log(data))}>
      <input {...register('username')} />
      {errors.username && <span>{errors.username.message}</span>}
      <input {...register('password')} />
      {errors.password && <span>{errors.password.message}</span>}
      <button type="submit">submit</button>
    </form>
  );
};