Although the outlook for stocks may look bleak today amid the current bear market, investors know this downturn won't last forever. Inflation has been slowing and with the recent jobs report showing the unemployment rate is rising, there are signs that the Federal Reserve might end up softening its stance on interest rate increases this year, which should lead to more favorable market conditions and potentially a bull run.

When that will happen, of course, is the million-dollar question. But as long as it does happen and you have money you can afford to invest and won't need to withdraw for a few years, then buying stocks can still make a lot of sense right now. And a safer option can be to invest in exchange-traded funds (ETFs).

Two ETFs that have outperformed the markets in the past five years and that show lots of potential in the future are iShares U.S. Medical Devices ETF (IHI 0.23%) and Invesco Solar ETF (TAN -0.47%).

1. iShares U.S. Medical Devices ETF

Over the past 12 months, medical device companies have struggled due to supply chain issues, particularly those with exposure to China where COVID-related lockdowns and restrictions have impacted demand. But in the long run, demand for medical devices is going to remain strong as they help patients stay on top of chronic conditions and assist hospitals in providing quality care. And that's why as long as you have money that you can afford to keep invested for multiple years, this is the type of ETF that can be a no-brainer buy.

The top three stocks in this fund are all big names in the healthcare industry that focus on making medical devices: Thermo Fisher ScientificAbbott Laboratories, and Medtronic. Collectively, these stocks account for more than 40% of the fund's weight. While that is a lot, it means there's some strong stability in the fund as it is anchored with some of the largest healthcare companies in the world. And the strategy has clearly worked as over the past five years the fund has vastly outperformed the S&P 500, rising 60% in value while the broader index has jumped by just 39%.

There are over 60 holdings in the fund and so investors do get some decent diversification. While the top three stocks make up a significant chunk of the ETF, the only other stock to account for 5% or more of its weight is another top medical device company -- Stryker. At 0.39%, the fund also charges a modest expense ratio.

2. Invesco Solar ETF

Another ETF that could make for a solid long-term investment is Invesco Solar. This fund focuses on companies that are involved in solar energy. Given the need for more renewable energy, this too seems like another no-brainer investment that should be full of growth potential. In the past five years, the fund has dwarfed the S&P 500 and even the medical devices ETF, amassing returns of 197%.

There could still be much more room for growth as a projection from Allied Market Research sees the global solar energy market rising to a value of $223 billion by 2026, which implies a compound annual growth rate of 20.5%. There are some attractive growth opportunities in the industry and an ETF can make a lot of sense in this case, as it can be difficult for investors to stay on top of best stocks in solar energy as the industry evolves.

The top three companies in the fund are First Solar, SolarEdge Technologies, and Enphase Energy, which account for 31% of the ETF's total weight. The fund is a bit smaller than the one focused on medical devices, with 54 holdings in total. Its expense ratio of 0.69% is also a bit higher, but given the potential long-run returns investors could earn from the fund, it's likely to be well worth the price.