The problem with your response is that violence should not be the first recourse. Confrontation should be.
"Please don't hit the child again."
Acquiesence? Okay, walk away.
Combative? Insist. "I said, please don't hit the child again. That's assault and I will report you."
Continued combative, step between the offender and the child, facing the offender.
If the offender moves aggressively, first strike is warranted but makes you the offender unless you have video showing the aggressive move.
Graduated response is best.
If a weapon is displayed, all bets are off: shoot first. Better to be in jail than in a hospital or morgue.