Inverse 38, beginning with the words, وَالَّذِينَ يُنفِقُونَ another trait in the character of the arrogant has been described. Ordinarily they themselves hold back any spending in the way of Allah and persuade others to do the same. Nevertheless, when they wish to show off before people, they do spend. Since these people do not believe in Allah and the Last Day, the question of spending their wealth for the good pleasure of Allah and with the intention of earning rewards in the life to-come just does not arise. Such people are the accomplices of Satan, therefore, the end of it all will be no different than the end of their comrade Satan.
This verse tells us that the way it is disgraceful to be niggardly and tardy in fulfilling due rights, very similarly, it is also extremely bad to spend to show off or to spend on heads which are purposeless. A good deed aimed at drawing applause from people - and which is not for Allah exclusively - is a deed not acceptable in the sight of Allah. In hadith, it has been declared as shirk (associating others in the divinity of Allah).
Sayyidna Abu Hurairah ؓ narrates that the Holy Prophet ﷺ said:
قال اللہ تعالیٰ انا اغنی الشرکاء عن الشرک من عمل عملاً اشرک فیہ معی غیری ترکتہ و شرکہ
"Allah Almighty says: I am absolutely free of any need to have partners. Whoever does a (good) deed and associates in it someone else with Me, I leave him (un أ helped) with this deed (of associating partners with Me) ".
Sayyidna Shaddad ibn Aws ؓ narrates that he heard the Holy Prophet ﷺ say:
عن شداد بن اوس قال سمعت رسول اللہ ﷺ مَن صَلَّی یرایٔ فقد اشرک، و مَن صَامَ یرایٔ فقد اشرک، ومَن تصدَّق یرایٔ فقد اشرک (احمد بحوالہ مشکوۃ)
"Whoever performed salah to show off, committed shirk; and whoever fasted to show off, committed shirk; and whoever gave in charity to show off, committed shirk." (Ahmad, as cited by Mishkat).
Sayyidna Mahmud ibn Labid ؓ عنہ narrates that the Holy Prophet ﷺ said:
عن محمود بن لبید اَنَّ النبی ﷺ قال اَن اخاف علیک الشرک الاصغر، قالوا : یا رسول اللہ وَ مَااشرک الاصغر ؟ قال : الرِّیاء (احمد بحوالہ مشکوۃ)
"What fills me with grave apprehensions about you is the minor shirk." The Companions asked: "0 Messenger of Allah, what is the minor shirk?" He said: "riya' (i.e. to do a good deed just to show off' ). (Ahmad, as cited by Mishkat)
Here, a narration from al-Baihaqi adds that, on the Day of Doom, when the reward for good deeds will be given out, Allah Almighty will say to the persons committing riya' i.e. the persons who did good deed just to earn the applause of the people:
"Go to those you wanted to see you doing good deeds in the mortal world and then find out for yourself if they have the reward for your deeds."