Design comparison
Solution retrospective
Feel free to test this app in your browser let me know of any issues and also Where and why to use interface or type very confused between these two and also how to use react-hook-form devtools for optimizations
Community feedback
- @tnamdevnotePosted 11 months ago
Hello, I'm working on the same challenge, and I came across your solution as I was trying to figure out the best way to define the form state in react. I took a look at your code, and you had
data.ts
file that definesstepsData
for each form, and you also had aPlanSchema
, which seems to be just the simpler version ofstepsData
. I think your code might be a solution to the problem that I'm having, but I would love to know your reasoning behind treatingstepsData
andPlanSchema
separately.0@Ofcl-JavedPosted 11 months agoHey @tnamdevnote , in
data.ts
file arraystepsData
is for map the form with dynamic values Like if I wanted to change fields or heading or title I just change in thestepsData
and it'll reflect in the Form. It's for better usecase instead of changing in components I'll change in the array. AndPlanSchema
is for form validation because I'm usingzod
for form validation so you have to create a schema for it so that it can validates. Even if I don't havestepsData
I still have to createPlanSchema
for validation1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord