Allah says in the Qur’an, Surah Hood 11, Verse 15-16; interpretation of which states:
“Whosoever desires the life of the world and its glitter, to them We shall pay in full (the wages of) their deeds therein, and they will have no diminution therein. They are those for whom there is nothing in the Hereafter but Fire, and vain are the deeds they did therein. And of no effect is that which they used to do.”
`Abdullah Ibn `Abbaas (died 68 AH) رضي الله عنه said concerning this verse:
“Verily those who show-off will be given their reward for their good deeds in this life. This will be so that they are not wronged, even the amount equivalent to the size of the speck on a date-stone. Therefore, whoever does a good deed seeking to acquire worldly gain – like fasting, prayer, or standing for prayer at night – and he does so in order to acquire worldly benefit, then Allaah says: `Give him the reward of that which he sought in the worldly life,’ and his deed that he did is wasted because he was only seeking the life of this world. In the Hereafter he will be of the losers.”
Mujaahid (died 104 AH) رضي الله عنه said concerning this verse:
“This verse was revealed concerning the people who perform deeds to be seen.”
Qataadah (died 118 AH) رضي الله عنه said concerning this verse:
“Whoever’s concern, intention and goal is this worldly life, then Allaah will reward him for his good deeds in this life. Then, when reaches the next life, he will not have any good deeds for which will be rewarded. However, concerning the believer, he will be rewarded for his good deeds in this life and in the Hereafter as well.”