To me, it depends on WHY the child is hitting.
If they are hitting and showing the early signs of bully behavior, I would simply slap back. Not hard enough to hurt them physically, just enough to be uncomfortable.
Many people worry that this teaches violence, but I disagree. If I hit because they are touching something, or screaming, etc. yes, I'm teaching them to react with violence.
But a child who is hitting, is ALREADY violent. By hitting back you re-assert that you have more power (more capacity for the violence) than them, and that there are very bad and scary consequences to being violent. Once they realize that this isnt pleasant, and stop hitting, then they will follow your example in how to properly act in certain situations without violence.
ON THE OTHER HAND, if she simply doesnt know her own strength, as alot of small children dont (trying to give you love pats) then simply dramatizing pain with a surprising loud "ouch" each time should do the trick, without being funny to her.