Confused first time mom...

When my son throws a tantrum I hug him and he calms down immediately. Is this the right approach?

I feel like I should be disciplining him or something but he’s 2 and may have autism so I’m not sure that he understands. If I ignore him, he cries longer and harder, so I end up giving in. I’m probably not holding off long enough for him to calm himself down.

What is the goal when a toddler throws a tantrum? Should I be calming him down, or teaching him a lesson?

My thing is, most of the time he’s crying because he didn’t get his way. So I don’t want to be rewarding bad behavior, or enabling him by giving him a hug every time he throws a tantrum, but whenever he gets that like he starts asking for a hug.