@formspree/react@2.5.0
·
31 commits
to main
since this release
Minor Changes
-
4c40e1b: # Fix types in @formspree/core
@formspree/core- fix
SubmissionDatahas a type ofanycausing everything after it to opt-out typechecking - remove a no-op
teardownmethod onClientandSession - remove
utils.nowand useDate.nowinstead - remove unused functions from
utilsmodule:append,toCamel,camelizeTopKeys - add tests for
utils.appendExtraDataand convert the test file to typescript - add tests for
session.data() - no longer export
Sessiontype
@formspree/react- update types as a result of
SubmissionDatais no longerany - fix
createPaymentMethoddoes not properly map payload when the submission data is a type ofFormData - fix the
Clientis not updated when project changes
- fix
-
49730d9: ## Improve error handling
@formspree/coresubmitFormfunction now will never rejects but always produces a type ofSubmissionResult, different types of the result can be refined/narrowed down using the fieldkind.- Provide
SubmissionErrorResultwhich can be used to get an array of form errors and/or field errors (by field name) Responseis no longer made available on the submission result- Update
@formspree/reactfor the changes introduced to@formspree/core
-
d025831:
@formspree/core- rename client config
stripePromisetostripesince it expects the resolved Stripe client not a promise
@formspree/react- add a new hook:
useSubmitwhich is suitable with code that uses other ways to manage submission state (e.g. with a library like react-hook-form) - update
useFormto useuseSubmitunder the hood - fix:
FormspreeContextupdates the client whenprops.projectchange
- rename client config