Back to feed
Dev.to
Dev.to
6/29/2026
The original title is: "Form validation without Formik or React Hook Form: treat your rules as domain logic"

The original title is: "Form validation without Formik or React Hook Form: treat your rules as domain logic"

Original: Form validation without Formik or React Hook Form: treat your rules as domain logic

Short summary

Move form validation logic out of UI libraries (Formik, React Hook Form) into reusable domain classes that can be tested without React, reused in import/export flows, and translated independently. Validation is a domain rule, not UI state—this pattern eliminates scattered logic, library lock-in, and enables moving rules to the backend without rewriting.

  • Validation belongs in domain logic, not form libraries
  • Use ValidationRule interface and AppException classes for reusable, testable rules
  • This pattern enables testing without React, multi-language support, and backend portability

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more