This would essentially just remove the class and then re-add it, effectively creating a “new” animation and reseting the cycle. However, React outsmarts this and doesn’t recognize the toggled class. To overcome this obstacle use a setTimeout to delay adding the class. After it has been removed for a few milliseconds, re-add it. Example:
This will outsmart react into thinking the animation was indeed removed. It will reset the animation before you start it again. Hope this helps!