The more you learn to not react to people the better off you will be.
This takes time and practice. To start with, when someone says something that gets your back up, instead of reacting straight away, stop, take a deep breath or two and think is this worth reacting too.
