I am trying to create a simple React app, but I am having trouble with "undo" functionality.
Example:
increase
and decrease
respectively Add and Subtract from the score. Let's say by 20 and 40undo
button that will undo the last action(s)?This should occur:
I guess that you can store the value of the previous score in a variable “preciousScore”. When you click on the undo button it set the score = previousScore
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.