One thing that has helped me is using positive reinforcement and lots of encouragement for good behaviour. When my toddler throws a tantrum, I first make sure he's not hurt or in danger - if not, I ignore it, which can be tough! But responding to bad behaviour just reinforces it.
I also try to narrative the situation and offer a positive spin on it - e.g., "Oh no, your tower fell down! That's frustrating. You want it to stand up, don't you? Let's build it together!" It helps them process their emotions and gives them some control over the situation too, which is often what they crave.
Also, giving them simple choices helps assert their sense of independence - e.g., "Do you want the red shirt or the blue one today?" Works like a charm most times!