import React from 'react'; import { useForm } from 'react-hook-form'; const Watch: React.FC = () => { const { register, handleSubmit, watch } = useForm<{ testSingle: string; test: string[]; testObject: { firstName: string; lastName: string; }; toggle: string; }>(); const onSubmit = () => {}; const test = watch('test'); const testObject = watch('testObject'); const testSingle = watch('testSingle'); const testArray = watch(['test.0', 'test.1']); const toggle = watch('toggle'); const watchAll = watch(); return (
{testSingle === 'testSingle' && (
Hide Content TestSingle
)}
{JSON.stringify(test)}
{JSON.stringify(testArray)}
{JSON.stringify(testObject)}
{toggle &&
Hide Content
}
{JSON.stringify(watchAll)}
); }; export default Watch;