Maybe a 2000 year old philosopher can teach us a thing or two about it.
Nihil Perditi ("I've Lost Nothing"). - Seneca.
Seneca after undergoing a great personal loss (family, business, friends) would be heard saying "Nihil Perditi"(I've lost nothing).
Whatever could be lost, was not considered a good by Seneca.
The key thing about "Nihil Perditi" is that whatever bad thing happened to me, it is in the past, it is spilled milk, and it is information. I can choose to look at it neutrally, while maintaining the learning experience from it.
That is not to say that "Things always happen for the best".
It is to say "Not crying for what has passed, and better equipped to deal with the future, should similar events happen".
Nihil Perditi is adapting your thoughts to only acknowledge what is positive about it, and rationalizing the negative so that it doesn't affect your emotional state.
You can choose to not be harmed by your past, and use the knowledge to move forward.
Seneca wasn't all talk though. He was an accomplished businessman back in ancient Rome, and served under Nero.
And he had the chance to prove his philosophy many times. By not thinking of anything that can be lost as a Good. Seneca included his own life in it.
The Test of Every Philosophy is How it is Practiced
Nero tested this belief when he asked Seneca to commit suicide believing of him as a traitor.
Seneca committed suicide in front of his wife and daughter, calmly, and saying "What need is there to weep over parts of life? The whole of it calls for tears."
His suicide was long and he actually had to speed up the process by taking hot baths to widen his blood vessels so that the blood would flow out faster.
And during all that time, he was calmly speaking to his students on philosophy.
Even at the end, Seneca didn't lose anything.