Version v1.0.0-rc.2
bluebill1049
released this
24 Sep 05:19
·
261 commits
to master
since this release
🎉 Zod resolver
import React from 'react';
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import * as z from 'zod';
const schema = z.object({
username: z.string(),
});
const App = () => {
const { register, handleSubmit } = useForm({
resolver: zodResolver(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>
);
};