Owning equities (through index funds) is one of the best ways to always beat inflation. They are the part of the economy that appreciates because of future returns, in future money, not past dollar amounts.
That said, most of current CPI "inflation" is not economy wide price increases, but comes from 1) car prices, because car manufacturers massively messed up and production is way down for the past two years, and 2) energy, which is from several global market issues. There's also housing, which is not in CPI, but that's also easily attributable to underproduction of housing since 2008 (and probably even for decades before that, honesty).
We are actually in incredibly good economic times, especially considering the massive destruction that the pandemic has wrought, and in the US, the lowered number of workers due to years of reducing immigration. I am glad people are not overly exuberant, but I with they were focused on the things that mattered more.