How can you allow a comment to hurt you? Easy, by being human and having feelings. Comments can't hurt if you're an empty husk of a person who has no feelings; if you're hypervigilant about bracing for attacks; or if you never take a risk of being vulnerable and never share anything important about yourself. None of these options is particularly healthy. Having no feelings is a type of major depression, and living in fight-or-flight mode will lead you there, or to an early grave. The last option is at least reasonable online (but not in relationships), but not so easy in practice.
A common theme in the responses here is the element of surprise, comments and criticism that blindsided the person by hitting them in a vulnerable spot that they didn't know that they were exposing.
That certainly comports with my experience in receiving hurtful comments.
That’s easy for you to say, but you don’t have their experience and you don’t feel their emotions. I agree that we should strive for that, but expecting everyone to just brush off everything is unrealistic.