Hamza Yusuf has a beautiful message of how we should deal with the hardships of the world. Calamities fall for different reasons.
The prophets had to deal with hardships so that their followers can see that there is hope when you deal with hardships.
It is also to stop us from falling into the trap of saying Allah hates me.