I'm a novice react developer working on a project, and was wondering if I could get some advice. This project is essentially converting a very complicated and large spreadsheet into a nice application. I'm also using material-ui for some of the components. The reason I'm here is because the way I currently have my fields set up feels wrong, and I was hoping some more experienced people could weigh in.
Essentially, I have all the data that creates each field in a psql database table (see the fieldData variable in the codesandbox) . I pull that data in via useEffect and axios, and run it through a function which outputs the fields (63 at the moment). I also have a reducer which controls the state of the components so I can add them together, and submit the data to the database, which I haven't implemented yet.
The reason I am running it through the database instead of just creating each component individually is so that later on, you can change/add fields from inside the application instead of having to edit the javascript. However, it feels like this is inefficient, or there's a better solution that I'm missing. I appreciate any help or feedback, thanks!
Codesandbox: https://codesandbox.io/s/adoring-dewdney-xx8w4?file=/src/App.js
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…