I try to make calculator app using react and redux, everything is fine just have problem with multiply decimals and operators. When I entry 8//2, 8**5, 3…5+6, I get errors. I just want to someone explaine me hot to prevent adding multiple decimals and operators, so it’s only one is allowed.
hard to see the problem without seeing some code, but you could add a boolean expression to your operator so once clicked have something like operatorClicked = true and then have the button disabled while true and then when you press number you can have it change back to operatorClicked = false so you can use operator again after you have clicked a number hope this helps
You can find code here.
when pressing the operators the display just goes back to 0 so and nothing duplicates so this is a totally different problem maybe you forgot to push your code github?
Yes, but you have the previusNumber that store the last number. When you press the operator you enter new value to displayValue.
this might help your problem
Okay, I will try this. Thanks