Form validation lib that works in tandem with useFormState
npm install use-valiuseVali is a hook that validates your form with a zod schema.
npm install use-vali
useVali's goal is to:
1. Honour the progressive enhancement strategy
2. Support the same schema as your server
3. Be easy to use and understand
4. Work with any form field
Example for forms that submit via actions
Example for forms that submit to an endpoint (including same page)
Progressive enhancement with server and client validation
If you encounter the TS error TS2589: Type instantiation is excessively deep and possibly infinite please set your version of zod to 3.22.4.
For more info: https://github.com/colinhacks/zod/issues/3435