If you can afford to buy a home and get a mortgage then it's best to buy your own home where you're in control of everything and don't have to go by a landlords rules.
But some people have no choice but to rent a home. With renting a home the landlord is supposed to take care of any problems with the home and if you buy a house you're expected to take care of the houses problems.