You need to adopt a sensible approach to losing.
Go over your game with an engine to see where you made mistakes and learn from them.
But most importantly you must accept losses as part of the game, and not be upset by them. Once you reach a level of expertise that you can play to all the time you will on average lose a little less than HALF of all your games !
If you cannot deal with that, then find another hobby.
I try not to let it get to me even after being told its a 'learning opportunity" and "it doesn't really matter" which is all true but it really is one of the worst feelings, especially when the opponent isn't taking his time and playing like blitz for some reason gets to me. I just wonder why losing isn't so bad for others or why people take loses differently in general.