diff --git a/README.md b/README.md index 79207ac..c4bf573 100644 --- a/README.md +++ b/README.md @@ -75,9 +75,8 @@ export function Form() { name: "guests", }); - const onSubmit = () => { - const validVisibleFields = pruneHiddenFields(conditions, getValues); - // Do something with pruned submission... + const onSubmit = (data: FormSchema) => { + // Do something with pruned & validated form submission data... }; return ( diff --git a/tests-e2e/mock-form/form.tsx b/tests-e2e/mock-form/form.tsx index d110491..aea1e68 100644 --- a/tests-e2e/mock-form/form.tsx +++ b/tests-e2e/mock-form/form.tsx @@ -35,11 +35,9 @@ export function Form() { reset, } = formMethods; - const onSubmit = () => { - console.log( - "Successfully submitted", - pruneHiddenFields(conditions, formMethods.getValues) as FormSchema - ); + const onSubmit = (data: BlankFormSchema) => { + // At this point, data has passed validation + console.log("Successfully submitted", data as FormSchema); reset(getDefaultValues()); };