React Hook Form validation resolvers: Yup, Joi, Superstruct, Ajv and etc.
npm install @psymorias/hookform-resolvers-ajvPerformant, flexible and extensible forms with easy to use validation.
resolver(schema: object, config?: object)
object | ✓ | validation schema |
object | | validation schema configuration object |
typescript jsx
import React from 'react';
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers';
import yup as * from 'yup';
const schema = yup.object().shape({
name: yup.string().required(),
age: yup.number().required(),
});
const App = () => {
const { register, handleSubmit } = useForm({
resolver: yupResolver(schema),
});
return (
);
};
`
$3
A simple and composable way to validate data in JavaScript (or TypeScript).

`typescript jsx
import React from "react";
import { useForm } from "react-hook-form";
import { superstructResolver } from "@hookform/resolvers";
import { struct } from "superstruct";
const schema = struct({
name: "string",
age: "number",
});
const App = () => {
const { register, handleSubmit } = useForm({
resolver: superstructResolver(schema),
});
return (
);
};
`
$3
The most powerful data validation library for JS.

`typescript jsx
import React from "react";
import { useForm } from "react-hook-form";
import { joiResolver } from "@hookform/resolvers";
import Joi from "@hapi/joi";
const schema = Joi.object({
username: Joi.string().required(),
});
const App = () => {
const { register, handleSubmit } = useForm({
resolver: joiResolver(schema),
});
return (
);
};
``