lundi 10 mai 2021

Best Practices - creating a form with optimistic UI pattern in react

I am in a process of creating a form using optimistic UI patterns in React. However, I am not sure what the best practices / most efficient design would be.

My client-side is connected to the server and to Postgresql. When the user clicks an add button from the client-side, a form pops up on the side with input boxes. Again, I'm trying to follow an optimistic UI pattern, so there is no strict apply or cancel button. I want to save the data to the database as the user types into the input box.

My question is- what would be the best way to do this? Making API calls to the server every time the input box data changes will not be very efficient. Should I make a timer that makes API calls every few seconds? Maybe make an API call when the user unfocuses an input box?

Aucun commentaire:

Enregistrer un commentaire