Narrated 'Ali: "The Prophet ﷺ - the Unlettered Prophet - exhorted me (saying): 'None loves you except a believer and none hates you except a hypocrite'." 'Adi bin Thabit (a narrator) said: "I am from the generation whom the Prophet ﷺ supplicated for".
The Prophet Muhammad (PBUH) was teaching Ali about how people would react to his faith in Allah and His Messenger. He said that only those who believe in Allah will truly love him while those who are hypocritical or do not have faith will hate him instead. This hadith reminds us to stay strong in our faith despite any opposition we may face from others because ultimately it is our belief which matters most to Allah and brings us closer to Him.