Skip to content

Releases: react-hook-form/resolvers

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>
  );
};

v2.8.10

17 May 07:15
c560af3
Compare
Choose a tag to compare

2.8.10 (2022-05-17)

Bug Fixes

  • update for other resolvers with new option (#404) (c560af3)

v2.8.9

15 May 08:59
259b4dc
Compare
Choose a tag to compare

2.8.9 (2022-05-15)

Bug Fixes

  • zod: add ability to skip zod's parsing (#401) (259b4dc)

v2.8.8

18 Jan 22:11
4ab4ec1
Compare
Choose a tag to compare

2.8.8 (2022-01-18)

Bug Fixes

v2.8.7

18 Jan 11:40
91f009b
Compare
Choose a tag to compare

2.8.7 (2022-01-18)

Bug Fixes

v2.8.6

18 Jan 09:01
83f3397
Compare
Choose a tag to compare

2.8.6 (2022-01-18)

Bug Fixes

v1.3.8

18 Jan 08:58
0f016f4
Compare
Choose a tag to compare

1.3.8 (2022-01-18)

Bug Fixes

v2.8.5

12 Dec 21:07
022139b
Compare
Choose a tag to compare

2.8.5 (2021-12-12)

Bug Fixes

v2.8.4

03 Dec 07:50
8a938cc
Compare
Choose a tag to compare

2.8.4 (2021-12-03)

Bug Fixes

v2.8.3

02 Nov 08:56
14683e5
Compare
Choose a tag to compare

2.8.3 (2021-11-02)

Bug Fixes

  • zodResolver: no exported member ParseParamsNoData (#264) (14683e5)