The Prophet promised that whoever says this when struck by calamity Allah will reward them and replace their loss with something better. Umm Salamah said this when her husband died and Allah gave her the Prophet himself.