MCPcopy Create free account
hub / github.com/react-hook-form/react-hook-form / SubForm

Function SubForm

app/src/useFormState.tsx:25–51  ·  view source on GitHub ↗
({ control }: { control: Control<FormInputs> })

Source from the content-addressed store, hash-verified

23};
24
25const SubForm = ({ control }: { control: Control<FormInputs> }) => {
26 const {
27 isDirty,
28 dirtyFields,
29 touchedFields,
30 isSubmitted,
31 isSubmitSuccessful,
32 submitCount,
33 isValid,
34 } = useFormState({
35 control,
36 });
37
38 return (
39 <p id="state">
40 {JSON.stringify({
41 isDirty,
42 touched: Object.keys(touchedFields),
43 dirty: Object.keys(dirtyFields),
44 isSubmitted,
45 isSubmitSuccessful,
46 submitCount,
47 isValid,
48 })}
49 </p>
50 );
51};
52
53export const UseFormState: React.FC = () => {
54 const { register, handleSubmit, control, reset } = useForm<FormInputs>({

Callers

nothing calls this directly

Calls 1

useFormStateFunction · 0.85

Tested by

no test coverage detected