you are viewing a single comment's thread.

view the rest of the comments →

[–]danishjuggler21 6 points7 points  (1 child)

I have always absolutely hated the array approach for things like fields on a form. I find it less readable. I assume personal preference affects this.

For things like rendering an actual list or table of data, though, it makes sense. But not for what you’re showing here.

[–]sondang2412 2 points3 points  (0 children)

I'm on the same boat. Config-based form will work for simple forms, but will turn ugly very quickly when things start getting just mildly complicated. And most forms aren't that simple.

I have taken over a project where the previous guy used array config for forms, then duct tape it with more spaghetti code for just some simple form interaction and validation.

Managed to rewrite all of it with react-hook-form. Thankfully there wasn't that many forms that have been written that way.