The bear market dragged down all three major indexes last year, but the Nasdaq Composite had it the worst. That's because the benchmark includes many high-growth players, such as technology stocks, and these types of investments are the first to suffer during times of higher inflation and general economic woes. But the good news is that they often are the first to rebound when market conditions improve. And that's exactly what's happening today.

The Nasdaq has rallied by 34% so far this year, outperforming the S&P 500 and the Dow Jones Industrial Average. This is as many of last year's beaten-down technology players -- such as Amazon (AMZN -0.46%), Tesla (TSLA 2.87%), and Alphabet (GOOG 5.33%) (GOOGL 5.59%) -- rebound.

This may be reason for you to cheer if you already own shares of these or other Nasdaq companies. But what about if you're looking to add to your positions, open new positions, or start investing from scratch? Though markets are on the rise right now, they still could dip on any disappointing economic or company news. So, after such gains, is it safe to invest in the Nasdaq right now?

Two investors drink coffee and study something on a computer.

Image source: Getty Images.

High-growth companies

As mentioned, the Nasdaq Composite index includes many companies that are particularly sensitive to economic news because their high-growth profiles are tied to macro conditions. For example, higher interest rates make it more difficult and expensive for these players to borrow the money they may require in order to grow their businesses.

Also, in challenging economic times, investors tend to flock to the safety of long-established companies with steady earnings paths -- businesses such as big pharma players. (People will need their medicines no matter what the economy is doing, so their revenues are cushioned even during tough times.) But they tend to shy away from growth stocks, seen as higher risk.

In better market conditions, though, growth stocks tend to rise because, soon, they may not face the challenges I just mentioned. And that means they can do what they usually do best: grow revenues at a fast pace.

Growth stocks, and therefore the Nasdaq, have benefited from this since the start of the year, and everyone is hoping the trend will lead sooner rather than later to the official beginning of the next bull market. So far, in the U.S., every bear market has eventually been followed by a bull market, so we can expect to transition to one this time too -- but we just don't know exactly when.

So, should you buy Nasdaq stocks now? Or could the index be heading for further declines before the next bull market? It's impossible to predict the index's next move, but, whether it continues to rally, takes a pause, or declines, it's still safe to buy stocks right now -- for two reasons.

First, market phases are temporary, so gains in the future could compensate for near-term troubles. Looking at the Nasdaq's record over time shows us that, after periods of declines, it has always resumed its climb higher.

^IXIC Chart

^IXIC data by YCharts.

A long-term focus

That's why it's key to buy stocks and hold them for the long term. Here's a specific example. If you'd sold Amazon shares in late 2018 during a period of declines, you would have missed out on a new wave of gains that started in 2020. As long as a company's long-term story remains compelling, it's a great idea to hold on through tough periods.

AMZN Chart

AMZN data by YCharts.

Second, even though the Nasdaq has climbed quite a bit, some stocks -- even those that have advanced -- remain excellent bargains. Apple (AAPL 0.41%) is a perfect example. The iPhone maker trades for only 28 times forward earnings estimates, which is dirt cheap considering the company's brand dominance, financial strength, and growth in the high-margin services segment. So, today, Apple -- and many other Nasdaq companies -- make top long-term buys.

Finally, remember that trying to time the market -- attempting to sell at the high points of its cycles and buy at the low points -- is nearly impossible to do successfully with any consistency. And over time, it generally won't add to your gains much. That's why it's best to keep investing throughout every market phase, focusing on opportunities of the moment and holding on for the long term. And today, you can continue doing this by investing in the Nasdaq and its high-growth companies.