Stocks are vastly superior to real-estate. Businesses with reliable growth and some pricing power.
The S&P500 has generated approximately a 266% return in the past 20 years (ex any dividends). The average home sale price has climbed by just under 100% in that time.
Real-estate will nail you annually on property taxes (although not in every state) and you have to maintain it (let's assume a best case and you own it without a mortgage).
You can sit on a stock you bought for a decade, not sell it, let it appreciate by a lot, and incur zero taxes on the holding the entire time.
The average US house incurs ~$2,500 in property taxes each year (a painful expense across a decade). And you have to out that cash every year. If for any reason you can't come up with the taxes, they seize your property; that doesn't happen with a stock holding. The government doesn't care if the real-estate is going up in value or not, they want their property taxes. At least if your equities don't go up, you owe nothing when you sell. Equity trades also have zero commission now in most cases - you can sell a million dollars worth of stock at zero commission; you can't do anything remotely like that in most cases with real-estate.
Most real-estate struggles just to keep up with inflation. Average home sale prices haven't managed to outrun the cost inflation in average new car sales in the past 20 years. You're probably as well off sitting on gold ETFs like GLD or IAU as you are typical real-estate as an inflation hedge (IAU only has a 0.25% management fee, far lower than the typical real-estate property tax).
In most states your real-estate will also suffer a persistently climbing tax basis if you're lucky enough to see value gains; and local governments love to increase property taxes whenever they can.
And last but not least, in most cases you can click a button and liquidate your stock holdings in a matter of seconds or minutes with near zero hassle.
Obviously that equation changes if you're an experienced, competent property manager and you can get a healthy yield from your real-estate; however that's a serious job, with an enormous time/effort/labor/legal/mental burden, not a low-effort side task (much less a near zero effort task like sitting on the S&P index).