It is reported that Imām Al-Ḥasan Al-Baṣrī – Allāh have mercy on him – said:

To learn a single topic of knowledge and teach it to a Muslim is more beloved to me than having the whole world and giving it in the cause of Allāh.

Al-Khaṭīb Al-Baghdādī, Al-Faqīh wa Al-Mutafaqqih article 53.