In a letter to Ibn Abbas the Governor of Basra, Imam Ali (AS) wrote:
Your happiness must be for provisions which are useful for you in the hereafter, and your sorrow must be for losing a thing (a Provision) for the hereafter. Do not get overjoyed for what you attain in the world (worldly goods/properties), and do not get too distressed for what you lose in the world (worldly assets); and dedicate your efforts for the world (you enter) after death [1].
[1] Nahjul Balaghah, Letter 22.
Source: en.shafaqna.com