For many tech companies and their investors, 2022 was a challenging year. All three major indexes finished the year down, but the tech-heavy Nasdaq Composite led the way in the wrong direction, dropping around 33%. Now, the story has completely changed.

The Nasdaq Composite, which tracks all stocks listed on the Nasdaq stock exchange, is up 34% for 2023 through Aug. 8. The rebound has been fueled by artificial intelligence (AI) and signs pointing to the country's economic recovery being smoother than first anticipated.

Considering how much the Nasdaq has surged this year, some investors are skeptical about investing in it, fearing a correction any minute now. That's a fair concern, but there's a better approach.

Zoom out and see the big picture

On the outside, the Nasdaq's rally reflects investors' changing sentiment around the tech sector as a whole. Underneath the hood are a relatively small number of big tech companies doing the heavy lifting.

AAPL Chart

Data by YCharts.

The surges by these stocks have pushed the Nasdaq to levels not seen since January 2022. That said, many stocks in the index have yet to recover. Instead of worrying too much about the current valuation and thinking you might have missed the boat (you haven't), ask yourself where you think the index will be five or more years from now.

One thing you don't want to do is assume it will eventually drop. Trying to time the market is tricky and often counterproductive. Base your investment decisions on long-term potential instead of speculating on short-term movements.

When in doubt, go the ETF route

Instead of focusing on individual companies in the Nasdaq, I would go the exchange-traded fund (ETF) route and get exposure to the broader index at once. The Nasdaq-100 index contains the 100 largest nonfinancial companies on the Nasdaq. It's much smaller than the Nasdaq Composite, which has around 2,500 companies, and is a popular way to invest in the Nasdaq.

You can't be certain how individual companies will perform, but you can be confident about the resilience and long-term outlook of major indexes like the Nasdaq-100. The most popular Nasdaq-100 ETF is the Invesco QQQ ETF (QQQ 1.54%), which happens to be the second most-traded ETF in the U.S.

The Invesco QQQ ETF contains companies from all 10 nonfinancial sectors, offering a bit of diversity (although technology accounts for over 57% of it). Past results don't guarantee future performance, but the Invesco QQQ has far outperformed the S&P 500 over the past decade. Here's how a $10,000 investment 10 years ago would look now.

QQQ Chart

Data by YCharts.

You're probably not going to witness 100% to 200% surges in a handful of months like individual companies in the Nasdaq have this year, but you also don't have the downside that could come with them. The long-term value you can receive from investing in the Nasdaq-100 is generally worth that trade-off.

Many of the top holdings in the Invesco QQQ ETF overlap those in S&P 500 and weigh heavily in both, so if you're an investor in both, be mindful of your diversification. They can both serve a valuable role in your portfolio.