The best practice would be to thoroughly analyze the game and also your thought process before, during and after the game. Besides, if after sincere hard efforts you still lose, it's important to have an attitude like this -
“I haven't failed, I've found 10,000 ways that don't work” - Thomas
Edison
In chess, that would mean -
I haven't failed, I have discovered that this
strategy/opening/tactic/etc. doesn't work.
In my personal experience, you often learn more from the games you lose than from the games you win. So use that to your advantage. Analyze the game thoroughly (of course with the help of an engine) and see where you went wrong. Also, identify faulty patterns of thinking during the game. For example -
"this position was objectively equal, but during the game I thought I
was worse and so I got demotivated and played badly".
Gary Kasparov suggested the following after winning (but I suppose it applies all the more after losing) -
"Even the game we won always contained mistakes; inaccuracies. It's
inevitable. I can hardly find one brilliant game with no mistakes."
"If we won, it is most likely because our opponent made the last
mistake. But, he made the last mistake and he is definitely analyzing
the game; he'll find what we did wrong in the previous stage of the
game. So what is important is to find it first."
I found some other interesting quotes on this page. Some of the more interesting quotes are -
Losing can persuade you to change what doesn't need to be changed, and
winning can convince you everything is fine even if you are on the
brink of disaster. - Garry Kasparov
Don't be afraid of losing, be afraid of playing a game and not
learning something. - Dan Heisman
I prefer to lose a really good game than to win a bad one. - David
Levy
Setbacks and losses are both inevitable and essential if you're going
to improve and become a good, even great, competitor. The art is in
avoiding catastrophic losses in the key battles. - Garry Kasparov
You may learn much more from a game you lose than from a game you win.
You will have to lose hundreds of games before becoming a good player.
- Jose Capablanca
Most players ... do not like losing, and consider defeat as something
shameful. This is a wrong attitude. Those who wish to perfect
themselves must regard their losses as lessons and learn from them
what sorts of things to avoid in the future. - Jose Capablanca