How do I populate form information from expressjs database back end into reactjs front end?

I have a form with several inputs that include combo boxes. I want the combo … Read more How do I populate form information from expressjs database back end into reactjs front end?

I have a form with several inputs that include combo boxes. I want the combo boxes to be pre populated with information from the database when the form loads. Examples of what would be in the combo boxes would be employee names, company departments, report categories, etc.

Thing is, I want these values to be dynamic and pulled from the database every time the form is loaded so information is as up to date as possible when the user opens it to fill it in.

My first thought was an API route that would send back an array of objects to be parsed into their corresponding combo boxes. If I went this method, would I be able to make that route only accessible to the form? As in someone can’t just type in URL/api/formdata and see the raw JSON? Does this even seem like a viable option, or is there something better and more industry standard?

Source: React – Stack Overflow



Leave a Reply

Your email address will not be published. Required fields are marked *