How to get toddler to stop hitting


He is almost two and has been hitting. A lot. Anytime he is upset or told no. Idk where he got it, just one day over night he started it.

What can I do? Right now I grab the arm he is using to hit and tell him no sternly. But it’s not really working obviously, it does make him cry and hurts his feelings when I do that.