freeCodeCamp calculator vReact

I’m creating a react version of a calculator and I’ve come across a setState problem. If you try it out, you will see, that math operation buttons need two clicks to add a class. Would be very happy, if someone could help me, thank you :smiley:

What class are you adding and why? Do you mean CSS class or JS class?

I’m adding CSS class with help of classNames library. I want to highlight the operation, when user selects it. I’ll also use bool value of the state to execute operation, when equals buttons is clicked.

I have split up callback functions based on their functionality and now it suddenly updates on first click…

Decimal points don’t work.