Skip to content

Releases: react-hook-form/resolvers

v2.4.0

17 Apr 08:36
c8b961b
Compare
Choose a tag to compare

2.4.0 (2021-04-17)

Features

import React from 'react';
import { useForm } from 'react-hook-form';
import { nopeResolver } from '@hookform/resolvers/nope';
import Nope from 'nope-validator';

const schema = Nope.object().shape({
  name: Nope.string().required(),
  age: Nope.number().required(),
});

const App = () => {
  const { register, handleSubmit } = useForm({
    resolver: nopeResolver(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>
  );
};

export default App;

v2.3.2

16 Apr 11:02
2ff9b66
Compare
Choose a tag to compare

2.3.2 (2021-04-16)

Bug Fixes

v2.3.1

15 Apr 08:30
4f87888
Compare
Choose a tag to compare

2.3.1 (2021-04-15)

Bug Fixes

  • yupResolver: multiple errors messages with same type (#156) (4f87888), closes #155

v2.3.0

13 Apr 07:49
73dfad7
Compare
Choose a tag to compare

2.3.0 (2021-04-13)

Features

import React from 'react';
import { useForm } from 'react-hook-form';
import { ioTsResolver } from '@hookform/resolvers/io-ts';
import t from 'io-ts';
// you don't have to use io-ts-types but it's very useful
import tt from 'io-ts-types';

const schema = t.type({
  username: t.string,
  age: tt.NumberFromString,
});

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

  return (
    <form onSubmit={handleSubmit((d) => console.log(d))}>
      <input name="username" ref={register} />
      <input name="age" type="number" ref={register} />
      <input type="submit" />
    </form>
  );
};

export default App;

v2.2.0

10 Apr 10:42
5f806f8
Compare
Choose a tag to compare

2.2.0 (2021-04-10)

Features

  • class-validator: add criteriaMode: all support (#151) (5f806f8)

Bug Fixes

Performance Improvements

v2.1.0

09 Apr 15:29
defa00b
Compare
Choose a tag to compare

2.1.0 (2021-04-09)

Features

import 'reflect-metadata';
import React from 'react';
import { useForm } from 'react-hook-form';
import { classValidatorResolver } from '@hookform/resolvers/class-validator';
import { Length, Min, IsEmail } from 'class-validator';

class User {
  @Length(2, 30)
  username: string;

  @Min(18)
  age: number;

  @IsEmail()
  email: string;
}

const App = () => {
  const {
    register,
    handleSubmit,
    formState: { errors },
  } = useForm<User>({ resolver:  classValidatorResolver(User) });

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

        <input type="text" {...register('email')} />
        {errors.email && <span>{errors.email.message}</span>}

        <input type="number" {...register('age', { valueAsNumber: true })} />
        {errors.age && <span>{errors.age.message}</span>}

        <input type="submit" value="Submit" />
      </form>
  );
};

export default App;

v2.0.1

08 Apr 07:44
6b0b235
Compare
Choose a tag to compare

2.0.1 (2021-04-08)

Bug Fixes

v2.0.0

02 Apr 07:17
fe53179
Compare
Choose a tag to compare

2.0.0 (2021-04-02)

BREAKING CHANGES

  • Require react-hook-form >= 7

Features

Bug Fixes

  • Joi pass down context from useForm (#122) (132a90e)
  • zod union error + reduce size (#126) (19dfa9b)
  • yup resolver typescript errors (8e10721)
  • Improve modules support (cjs, esm, umd) (507ee0d)

Performance Improvements


V2 🚀 (#108) (fe53179), closes #108 #97 #114 #116 #115 #117 #123 #125 #124 #126 #127 #128 #129 #131 #130 #132 #134 #136

v2.0.0-beta.17

31 Mar 20:08
Compare
Choose a tag to compare
v2.0.0-beta.17 Pre-release
Pre-release

2.0.0-beta.17 (2021-03-31)

v1.3.7

30 Mar 08:31
260448a
Compare
Choose a tag to compare

1.3.7 (2021-03-30)

Bug Fixes