pros and cons of setting onchange updates to local vs global state?

Viewed 13

I'm working on a React input form. The entity object exists in global state (Redux Toolkit). The form has about 20 inputs. The onChange event for each input should update the entity object. The Next button at the bottom of the page should redirect to the next component which will reference the updated object in global state.

By default I can update the entity object in global state on the first page but it seems like there could potentially be a performance advantage to making local state updates and then copying the entity object from local to global state when the user clicks the Next button.

Would there be performance advantages with that approach? Or would making onchange updates directly to the object in global state have a negligible performance disadvantage? Updating the object in global state would be DRY-er for sure. Interested in perspectives from others who have experimented with both approaches

0 Answers
Related