Al-Bara (May Allah be pleased with him) reported:
A man equipped with arms came to the Prophet (ﷺ) and asked: "O Messenger of Allah! Should I go and fight or should I embrace Islam first?" He (ﷺ) replied, "Enter in the fold of Islam and then fight." He embraced Islam and fought until he was killed. Thereupon the Messenger of Allah (ﷺ) said, "He accepted Islam for a short time but was rewarded much."[Al-Bukhari and Muslim].
App reference: Book 12, Hadith 26
Arabic/English book reference: Book 12, Hadith 1310