This is a form state management tools in react that I started to adopt and still believes it can be improved. However, this has proven to improve performance and code readability since I started to adopt it.
This brings about creating 3 files for form state however, it is really easy to use.
Form.jsthis is the file which house the render components of the UI without any business logic or any state management, you can see it is just a functional componentFormContext.jsIn order to avoid passing of props down many levels, the React context is my favourite lately. It basically used to pass down props in the hierarchy and helps to avoid multiple re-rendering of the component if a state or props changes.FormProvideram still thinking of a suitable name to call this however, this is where the business logic and manipulation takes place, this handles the state, and pass down to the props, this also handles and form handlers.
Using this type of architecture I have seen a lot of performance gains and code tends to very clean when I separate the UI from the logics