iway1 / react-ts-form

https://react-ts-form.com
MIT License
2.01k stars 35 forks source link

Wrap form with react-hook-form->FormProvider so custom FormComponent … #53

Closed mulyoved closed 1 year ago

mulyoved commented 1 year ago

Wrap form with react-hook-form->FormProvider so custom FormComponent can have access to useForm->handleSubmit

When passing value to FormComponent but not to form, it is needed to be able to access handleSubmit, in this case, react-hook-form has FormProvider so the child FormComponent can call

  const { handleSubmit } = useFormContext();
codecov-commenter commented 1 year ago

Codecov Report

Base: 100.00% // Head: 99.05% // Decreases project coverage by -0.95% :warning:

Coverage data is based on head (c22d866) compared to base (3fcd707). Patch coverage: 88.46% of modified lines in pull request are covered.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #53 +/- ## =========================================== - Coverage 100.00% 99.05% -0.95% =========================================== Files 9 9 Lines 315 319 +4 Branches 82 83 +1 =========================================== + Hits 315 316 +1 - Misses 0 3 +3 ``` | [Impacted Files](https://codecov.io/gh/iway1/react-ts-form/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Isaac+Way) | Coverage Δ | | |---|---|---| | [src/unwrap.tsx](https://codecov.io/gh/iway1/react-ts-form/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Isaac+Way#diff-c3JjL3Vud3JhcC50c3g=) | `88.88% <0.00%> (-11.12%)` | :arrow_down: | | [src/createSchemaForm.tsx](https://codecov.io/gh/iway1/react-ts-form/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Isaac+Way#diff-c3JjL2NyZWF0ZVNjaGVtYUZvcm0udHN4) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Isaac+Way). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Isaac+Way)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

iway1 commented 1 year ago

Nice thanks!