What library to use with form actions?
Unanswered
Harlequin posted this in #help-forum
HarlequinOP
I feel like the vanilla way of doing for actions lacks a little bit. Are there any good libs to make it easier?
10 Replies
Netherland Dwarf
May i ask what do you to make actions “more easier”? @Harlequin
Do you mean validation or …?
HarlequinOP
i might use zod for validation, but to return and show errors etc
do you have a snippet on how to do it the proper way? there are so many approaches. i need loading spinners etc
Netherland Dwarf
React hook forms you can use
It integrates with zod
And now with next.js 14 you can also use useFormStatus to get the pending state of the form action
React hook form handles all the form input updates and returns the error for each which integrates with zod and shows the zod error
You can look at https://m.youtube.com/watch?v=R_Pj593TH_Q
And https://m.youtube.com/watch?v=uAh6ZOytUDk
For setting this up.
And https://m.youtube.com/watch?v=uAh6ZOytUDk
For setting this up.
If not then maybe someone else can share their thoughts.