iusehooks / usetheform

React library for composing declarative forms, manage their state, handling their validation and much more.
https://iusehooks.github.io/usetheform/
MIT License
86 stars 33 forks source link

Refactored a couple of hooks for readability #1

Closed bl4ckm0r3 closed 5 years ago

bl4ckm0r3 commented 5 years ago

I am not a big fan of break or then...catch and es6 offer a lot of interesting tools to avoid those :) Unfortunately there are no tests but it should work since the logic hasn't changed! @antoniopangallo Please double check before merging!

antoniopangallo commented 5 years ago

About the async await, it is nice but it is not working in IE 11 and maybe then...catch will be better in this case. What do you think?

marcosparagna-eb commented 5 years ago

microsoft isn't supporting ie11 anymore, so why would you? :D anyway i'll update the pr to restore promises!

antoniopangallo commented 5 years ago

I just noticed that in "hooks/useValidation.js" there is a duplication of the function getValidationMsg(), would you mind to change even that one or even better move it in the utils and remove that duplication?