Tuomo Kankaanpää
2y ago
Senior Software Engineer | I help web developers to learn Next.js | 10+ years industry experience

This is my framework for creating a React form component that talks (GET & POST) with an API:
Create the HTML for the form. No functionality yet, just the structure.
Add the data fetching from the api. No error handling yet, just getting the data to the component and console.logging it.
Add state for the form and populate the form with the data
Add functionality for a save button. Getting the data from the state and sending it to the api. No error handling or loading indicators yet.
Add loading indicators and disable fields when saving and fetching the data
Add notification for successful saving
Add error handling and show notification for errors
Add css styling
This is more or less the framework I use when creating components from scratch.
The most important thing here is that you split the tasks in smaller chunks and don't try to make everything at once.