The jury still is out when it comes to one of investors' biggest questions right now. Are we heading for a recession? The Federal Reserve modeled for a mild one later this year. Meanwhile, the economy has shown a certain degree of resilience -- and some economists say a recession could happen later or not at all.

This lack of visibility may have you wondering about how you should invest right now. Should you go for growth stocks that tend to outperform in strong economies? Should you seek the safety of dividend stocks and healthcare players? Or should you wait on the sidelines for more clear signals from the economy? Let's consider the situation -- and find out.

Bull markets follow bear markets

The stock market has rallied since the start of the year. That's after a tough 2022, when all three major benchmarks sank into bear territory. We're not in a bull market yet. But here are two positive points: Bull markets always follow bear markets. And many companies have reported progress in their recovery from last year's troubles. This could continue to fuel stock gains.

So, there's reason to be optimistic that a new bull market is on the way -- even if it doesn't arrive immediately.

Meanwhile, as mentioned above, it's not clear whether the predicted recession will happen. A recession would likely weigh on corporate earnings and on households' ability to spend. All of this could hurt the momentum we've seen in the stock market so far this year. If a recession doesn't take place, though, earnings may grow more easily, and stocks may continue to climb.

Now, let's talk about what investors should do. First, it's important to say this. You shouldn't invest for one particular economic situation. That's because these moments are temporary. A recession won't last forever. And neither will the next bull market. But the good news is, in spite of bear markets and economic downturns that interrupt momentum, the market gains over time.

^SPX Chart

^SPX data by YCharts

This means investors who choose a variety of strong companies and hold on for the long term may grow wealth -- even if they've invested ahead of a recession.

So, today, if you've recently bought stocks don't panic. Even if the economy slips into a recession this year and this weighs on your holdings, that's OK. If you hold these positions for at least five years, a dip now may not matter much by the end of that time period.

A long-term view

If you haven't yet invested, but were hoping to, go for it. Through a long-term lens, many stocks look promising right now. For example, Moderna (MRNA 1.69%) hasn't participated in the rally this year. The biotech company has fallen out of favor as investors worry about post-pandemic coronavirus vaccine sales. But Moderna aims to launch two other respiratory vaccines next year -- and has plans to build a billion-dollar respiratory franchise by 2027. This means an investment today could pay off later this decade.

You'll find other candidates across sectors. And even certain stocks that have rallied since the start of the year still look reasonably priced considering their long-term prospects. Amazon (AMZN 3.43%) advanced more than 50%. But the company still trades at only 2.5 times sales, lower than its average over the past few years. Amazon should benefit from its leadership in the high-growth industries of e-commerce and cloud computing.

AMZN PS Ratio Chart

AMZN PS Ratio data by YCharts

So instead of investing for a recession or a period of growth, it's best to look at which companies may excel over time -- and consider whether their valuations look right today.

A bit of security

Meanwhile, it's always a good idea to cushion your portfolio with a bit of security. And a great way to do this is through stocks known for paying dividends and increasing them over time. The list of Dividend Kings is a great place to look. This way, whether the market rises or falls during a particular year, you'll still collect passive income.

Healthcare companies represent another safe area. People always need their medical treatments. This helps many of these companies maintain steady earnings regardless of the economic environment.

It's also important to consider your own personal investment style, no matter what the market is doing. If you're a cautious investor, you may want to favor dividend stocks. If you're an aggressive investor, you might want to buy more growth stocks.

And whether you're cautious or aggressive, if you choose carefully and hold for the long term, you could grow your investment significantly over time -- whether a recession happens at a particular time or not.