marilari88 / zod-playground

Play with Zod schema validation
https://zod-playground.vercel.app
MIT License
31 stars 1 forks source link

♻️ Refactor state management #37

Closed marilari88 closed 3 months ago

marilari88 commented 3 months ago

I refactored the code by removing the form and moving the raw strings into a useState hook. The parsedSchema, parsedValues, and validationResults are now treated as derived states. This approach feels much clearer than before. Initially, I had concerns about performance, but I haven't experienced any issues during my tests. However, there is still room for performance optimization. We can achieve this by utilizing memoization or by breaking up the values state and moving it inside its validation component.

vercel[bot] commented 3 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zod-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 21, 2024 10:06pm
marilari88 commented 3 months ago

@giacomocerquone any chance you could take look at this?

marilari88 commented 3 months ago

@davc0n all concerns related to code formatting could be addressed in a dedicated PR in which we can try to review the prettier rules