How to re-use code for buttons for same operations

I have used below code multiple times for the above buttons.

To increase/decrease the quantity. Here I want to use this code for every button in the application. To minimize the coding part.

Thank you

Use a component which wraps your buttons.

Yes, as mentioned you should convert the buttons into a component.