Buying a house if you can afford to and can get approved for a mortgage is always better than renting a house.
For one when you buy a house you don't have a landlord to tell you what you can and can't do with the property.
When you rent a house you have to get permission from your landlord for things and then have to get them to fix problems that may arise.
When you buy a home you don't have a landlord to answer to or to get to fix things.
Plus with renting you'll always have a monthly fee to pay to live there and the rent could go up but with a mortgage you do have payments for 15 to 30 years but eventually you'll have no more payments except for your real estate tax payments but that is paid once per year.
If possible I would buy a home instead of renting. I used to rent and hated it and I'm glad I now have my own home where I can do what I please with it and also I don't have a landlord coming over to do inspections which is another great benefit of owning a home vs renting a home.