as mentioned, I have a project with multiple components, all of which have some event handling and operations. And different action events within these components may result in the same result, including updates to the redux.
for example, I have two methods that operate on redux, asce,update, listens on one of the buttons in component A, and triggers asce (), update () when pressed. Also listen to one of the buttons in component B and trigger both methods when pressed.
doesn"t seem to be a problem at the moment, because the method is relatively simple, but if I need to do some processing and complex operations on the data before or when there are more components, it seems very complex to write, resulting in the same complicated code in multiple places.
is there any way to make code with the same function in different components be written only once?