React Stepper increments 10 then 1

The stepper increments first input click *10 then +1, don’t know why…

<Stepper
small
value={item?.qty || 0}
input={false}
className=“item-qty circle”
stepperMinusClick={() => incrementItem(item.unique_id)}
stepperPlusClick={() => decrementItem(item.unique_id)}
/>

What is in your incrementItem function?

Looks like it treats the values as strings, and therefore concatenates them. So 5 + 1 = 51

You can try to use parseInt(value) in your functions to convert the argument to an integer before you add them.

1 Like

Yes right, i added parseInt() to the value and work fine! thanks

const incrementItem = (unique_id) => {
/* data to pass */
const body = {
session_guid: session_guid,
unique_id: unique_id
};
// call store here
f7.store.dispatch(‘incrementQty’, { body });
};

this is my function, but on click nothing still happens. If i do Segmented buttons it’s working.