17 But when you fast, put oil on your head and wash your face, 18 so that your fasting isn’t obvious to others but to your Father who is in secret. And your Father who sees in secret will reward you. (Matthew 6:17-18 CSB)
Fasting is a practice with many benefits both physical and spiritual. Notice that pride nor vanity is noted as a benefit.
No matter what we do, be it fasting, tithing, giving to charities, helping others it is best done in secret. It is a transaction between you and God for your benefit and the benefit of mankind.
When we do it for show then we are doing it for the wrong reason. It isn’t a photo-op.
This can be said for many aspects of our faith life. It is a transaction between ourselves and God where the byproduct is manifest and visible in our lives, not the act itself.
In this we are showing our true nature and that by which we conduct God’s business.