Skip to content

Releases: react-hook-form/resolvers

v2.8.2

06 Oct 06:24
66182f8
Compare
Choose a tag to compare

2.8.2 (2021-10-06)

Bug Fixes

  • TypeScript issues with the latest react-hook-form version (66182f8)

v2.8.1

18 Sep 20:02
33abb47
Compare
Choose a tag to compare

2.8.1 (2021-09-18)

Bug Fixes

v2.8.0

19 Aug 07:59
35cedc7
Compare
Choose a tag to compare

2.8.0 (2021-08-19)

BREAKING CHANGES

v2.7.1

04 Aug 08:08
4309d1c
Compare
Choose a tag to compare

2.7.1 (2021-08-04)

Performance Improvements

v2.7.0

31 Jul 23:01
Compare
Choose a tag to compare

2.7.0 (2021-07-31)

Features

import { useForm } from 'react-hook-form';
import { typanionResolver } from '@hookform/resolvers/typanion';
import * as t from 'typanion';

const isUser = t.isObject({
  username: t.applyCascade(t.isString(), [t.hasMinLength(1)]),
  age: t.applyCascade(t.isNumber(), [t.isInteger(), t.isInInclusiveRange(1, 100)]),
});

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

  return (
    <form onSubmit={handleSubmit((d) => console.log(d))}>
      <input {...register('name')} />
      {errors.name?.message && <p>{errors.name?.message}</p>}
      <input type="number" {...register('age')} />
      {errors.age?.message && <p>{errors.age?.message}</p>}
      <input type="submit" />
    </form>
  );
};

v2.6.1

13 Jul 12:26
52145b0
Compare
Choose a tag to compare

2.6.1 (2021-07-13)

Bug Fixes

v2.6.0

19 Jun 08:55
d8aff3d
Compare
Choose a tag to compare

2.6.0 (2021-06-19)

Features

v2.5.2

31 May 07:34
7bf09fd
Compare
Choose a tag to compare

2.5.2 (2021-05-31)

Bug Fixes

v2.5.1

16 May 17:15
f67a10f
Compare
Choose a tag to compare

2.5.1 (2021-05-16)

Bug Fixes

  • zodResolver: improve unionErrors parsing (#168) (f67a10f)

v2.5.0

13 May 15:31
d88bc94
Compare
Choose a tag to compare

2.5.0 (2021-05-13)

Features

import React from 'react';
import { useForm } from 'react-hook-form';
import { computedTypesResolver } from '@hookform/resolvers/computed-types';
import Schema, { number, string } from 'computed-types';

const schema = Schema({
  username: string.min(1).error('username field is required'),
  password: string.min(1).error('password field is required'),
  password: number,
});

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

  return (
    <form onSubmit={handleSubmit((d) => console.log(d))}>
      <input {...register('name')} />
      {errors.name?.message && <p>{errors.name?.message}</p>}
      <input type="number" {...register('age', { valueAsNumber: true })} />
      {errors.age?.message && <p>{errors.age?.message}</p>}
      <input type="submit" />
    </form>
  );
};

export default App;