We all have encountered the situation when we need to provide lots of input fields on a webpage for whatever reason but dread coding it because we need to keep track of all the changes in state. In React, the state gives us the ability to track the values of elements when they change and it allows rendering of those values efficiently without having to retrieve them from the backend over and over again.

In a simple situation of an input or edit page, we use the state to keep track of what values the user enters into a data field. For example, if we have an input field for email address, we usually defined a function to handle the onChange event.

#destructuring #dry #javascript

Streamline and DRY Your Code When Handling Change Events in JavaScript
2.30 GEEK