First of all you need to let go of negative emotions like anger. If you lost some money, then accept it and move on. Next step is to realise, that if a losing streak reach a certain magnitude, then maybe its not just variance or "a downswing" but a result of the fact, you are not beating the games, you are playing. Poker is raked, so even if you are an average or slightly above average player in a game, you will still end up losing. And in that situation you basically have 3 options:
1) You can study and try to improve.
2) You can change your goals and be ok with losing within a certain budget, because you are mostly playing for fun.
3) You can reconsider your game selection.
The first two points more or less explain themselfes, so let me give you two examples, where I took action number 3. When I was new to poker, I played cash games on
pokerstars, and after a while and reaching 10NL-16NL a big difference began to emerge between my results on regular 9-max tables and similar stake Zoom 6-max tables. And then I decided to follow the path of least resistance and play only regular 9-max tables.
More recently I had a period playing on ACR Poker mostly to grind for the SnG leaderboard. And while the money I got from the leaderboard plus general rakeback kept me over water, I actually lost pretty badly at the tables, and I found the games to be overly reg infested and often not running, when I wanted to play. So for now I gave up ACR Poker and moved back to PokerStars.