zod in the action or react-hook-form on the client, solo and launching in two weeks Validation
Six forms, the biggest has nine fields. I keep starting react-hook-form + a resolver, then remembering the action has to validate anyway, then wondering why I'm writing it twice. Two weeks until I need this in front of people and I am one person. What do you actually do here?
@listener_lena · 3mo ago · 2 replies
Server first, always, because the action is a public endpoint and client validation is a UX feature. One schema in a plain file both sides can import,
safeParsein the action, errors back throughuseActionState:The field error shape maps straight onto your inputs by name. For nine fields that is the whole implementation. Add react-hook-form later if a form gets long enough that a round trip per validation feels bad.
Reply
Report
@query_quinn · 3mo ago
Worth knowing that flatten-style output only gives you the top level. If you have nested objects or arrays of line items, go straight to the tree/issue list and key errors by path — trying to flatten a nested schema is where people give up and reach for a library.
Reply
Report