It depends on the age of the child, how frequent it is, whether it's frustration/anger or something else. For a child under 2, I pet their hand against my arm, then pet their hand against their face, all while saying gentle touch. For a child who is at least 2, I reinforce that the child needs to use words, not hands, and I remind the child that people like playing with nice people, but nice people don't hit. No matter how old the child is, I try to figure out why the child is hitting, and I work on preventing it.