R.L.
This is pretty common at this age and most of the time it is frustration from not being able to communicate effectively. So I think it's important to try and find out why he is hitting and what the triggers for the behavior are. Then try to show him a better way to deal with it. Using words and hand signals for instance instead of hitting.
Definitely make it clear that hitting is a no no, but there is no need to go overboard because if he sees that this behavior makes you upset and he is getting attention for it he will continue to do it to get a rise out of you.
Show him hugs are better than hits. Let him know that you understand he is frustrated and mad, that it is ok to say I'm mad, but it's not ok to hit.
Hang in there, this is a phase that will pass!