Jabir bin Abdullah (RadiAllahu Anhu) narrates:
“The neighbourhood of my tribe, Bani Salim, was rather far from the mosque. There were some vacant sites around the Prophet’s mosque so we wanted to sell our house and move closer to the mosque.
At that time the following verse was revealed:
“We bring the dead to life and We record what they send ahead and what they leave behind. We have listed everything in a clear register”. (Yasin 36:12)
When he heard of our intention, the Messenger of Allah ﷺ said to us:
“I hear that you wish to move closer to the mosque, is this true?”
They said: “Yes, o Messenger of Allahﷺ. We truly wish for this”.
Then the blessed Prophet ﷺ said:
“O Bani Salim! Remain where you are and receive a reward for each step you take in coming to the mosque. Yes, remain where you are; and let there be a reward written for every step you take in coming to the mosque”. (Muslim, Masajid, 280, 281; Tirmidhi, Tafsiru’l Qur’an, 36/1).