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

Function App

examples/V7/customMaskedInputWithController.tsx:44–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42};
43
44export default function App() {
45 const {
46 handleSubmit,
47 formState: { errors },
48 control,
49 } = useForm({
50 reValidateMode: 'onSubmit',
51 defaultValues: {
52 ControlledMaskedInput: '7',
53 },
54 });
55 return (
56 <div className="App">
57 <form onSubmit={handleSubmit(onSubmit)}>
58 <div>
59 <Controller
60 render={({ field }) => <CustomMaskedInput {...field} />}
61 rules={{
62 validate: {
63 inputTelRequired: isNotFilledTel,
64 },
65 }}
66 name="ControlledMaskedInput"
67 control={control}
68 />
69
70 {errors.ControlledMaskedInput && (
71 <p>{errors.ControlledMaskedInput.message}</p>
72 )}
73 </div>
74 <input type="submit" />
75 </form>
76 </div>
77 );
78}

Callers

nothing calls this directly

Calls 2

useFormFunction · 0.85
handleSubmitFunction · 0.85

Tested by

no test coverage detected