What is the best code architecture for huge forms? #3055
Unanswered
AkselAllas
asked this question in
Q&A
Replies: 2 comments 6 replies
-
I'm gonna try using FormProvider |
Beta Was this translation helpful? Give feedback.
0 replies
-
I went with the second option and ended up with 1500+ lines. Most of my controllers are between 20-25 lines as in the image below (I'm using MUI). I thought of creating abstractions but figured they would be a pain to maintain / hard to understand in the future. @AkselAllas How was your experience with using FormProvider? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a similar question to:
https://stackoverflow.com/questions/54850281/react-dividing-a-large-form-into-multiple-components
When I have ~40 inputs and I would get to ~1000 lines of code, then what is the best way to structure my code?
I'm thinking about two choices:
I make Controlled Child Components using Controller and having that Child Component pass up only valid values in the style of
{input1: input1Value, input2: input2Value, input3: input3Value}
. The downsides to this is the double rendering of those inputs and having to spread the new object passed up in anonSubmit
.I make everything flat in one file, which goes 1000+ lines.
Beta Was this translation helpful? Give feedback.
All reactions