Cuando uno desarrolla aplicaciones móviles con react es normal que al principio utilice repetidas veces las mutaciones de Estados para ver cambios reflejados en tiempo real pero uno desconoce que a la larga puede ser difícil de mantener y crea problemas de rendimiento.
When developing mobile applications with React, it's normal to use state mutations repeatedly at first to see changes reflected in real time, but you don't realize that in the long run, it can be difficult to maintain and create performance problems.
A very common case to see is when working with forms since the forms have several fields to fill out and if you are just starting in the world of web development it is normal for you to think that each field should have a unique state mutation but this would mean that you would have to be applying state changes for each form field.
Son un poco difícil de entender al principio pero manera resumida diría que es más fácil de administrar si se utiliza un solo estado que se administre a través de llaves y valores. Con un simple estado se pueden obtener todos los valores de cada campo del formulario y simplemente clonando los valores anterior se modifican los necesarios por el nombre de su llave.
They're a bit difficult to understand at first, but in short, I'd say they're easier to manage if you use a single state managed through keys and values. With a single state, you can obtain all the values for each field in the form, and simply clone the previous values to modify the necessary ones using their key names.
Having a single state for a form makes it much easier to identify where an error might be found, if one exists, and what each specific field should have. In this code, I provide a visual example of both the website and the code editor, showing how a single state retrieves all the form values and then simply sends them to the database.