Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react hook form with yup resolver

import { yupResolver } from '@hookform/resolvers/yup';
import { useForm } from 'react-hook-form';

const useValidationForm = (schema: any) => {
	const { ...props } = useForm({
		mode: 'onChange',
		resolver: yupResolver(schema),
	});

	return {
		...props,
	};
};

export default useValidationForm;
 
PREVIOUS NEXT
Tagged: #react #hook #form #yup #resolver
ADD COMMENT
Topic
Name
8+1 =