In the Name of Allah, the Most Gracious, the Most Merciful
مَن كَانَ يُرِيدُ الْحَيَوةَ الدُّنْيَا وَزِينَتَهَا نُوَفِّ إِلَيْهِمْ أَعْمَالَهُمْ فِيهَا وَهُمْ فِيهَا لاَ يُبْخَسُونَ – أُوْلَـئِكَ الَّذِينَ لَيْسَ لَهُمْ فِى الاٌّخِرَةِ إِلاَّ النَّارُ وَحَبِطَ مَا صَنَعُواْ فِيهَا وَبَاطِلٌ مَّا كَانُواْ يَعْمَلُونَ
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.
Surah Al Hud Chapter 11 ayah 15-16
The Great Scholar Hafiz ibn Kathir (Rahimahullah) wrote in his Tafsir explaining these verses
Al-`Awfi reported that Ibn `Abbas 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.” Ibn `Abbas continued saying, “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 Allah 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.” A similar narration has been reported from Mujahid, Ad-Dahhak and many others. Anas bin Malik and Al-Hasan both said, “This verse was revealed concerning the Jews and the Christians.” Mujahid and others said, “This verse was revealed concerning the people who perform deeds to be seen.” Qatadah said, “Whoever’s concern, intention and goal is this worldly life, then Allah will reward him for his good deeds in this life. Then, when reaches the next life, he will not have any good deeds that will be rewarded. However, concerning the believer, he will be rewarded for his good deeds in this life and in the Hereafter as well.”