While the S&P 500 has gained nearly 20% so far this year, some stocks have hugely underperformed the market and are significantly off their all-time highs. Higher interest rates have been the biggest growth hurdle for most companies, with investors fearing the headwind could last much longer.

But fear often clouds conviction and can mean missed opportunities. Companies taking advantage of solid growth catalysts should be able to navigate the storm, and their stock prices could rebound in the near future as the markets finally begin to see value in them.

Two such beaten-down stocks that look like solid buys now are NextEra Energy Partners (NEP -0.89%) and Cognex (CGNX 2.06%). After their recent sell-offs, both stocks are now down more than 60% from their all-time highs, making it an opportune time to buy. Here's why these two Motley Fool contributors think so.

NextEra Energy Partners wants to grow its dividend by 6% yearly

Neha Chamaria (NextEra Energy Partners): Shares of NextEra Energy Partners are down a staggering 74% from their all-time highs, with nearly all of those losses coming in 2023: The renewable energy stock has lost 69% of its value so far this year.

Popular among income investors because of its dividend stability and growth, the company stunned the markets when it recently cut its dividend growth forecast through 2026 from a range of 12% to 15% annually to 5% to 8%, with a target of 6%. Higher interest rates made it costly for NextEra Energy Partners, compelling it to reduce its dividend growth goal.

But the worst could be over for the company. Its parent, NextEra Energy, believes a dividend growth rate of 6% is sustainable, comparable to its peers, and, as its CFO said in the quarterly call with analysts, in the "best interest of unit holders over the long term." NextEra Energy Partners also doesn't expect to issue shares to raise funds until 2027 as it works through its transition plan.

NextEra Energy Partners is doing a couple of things to boost its cash flows: It will repower its existing wind assets to produce energy more effectively, and it will sell its natural gas pipelines. It has already identified some wind assets to repower through 2026 and has struck a deal with oil and gas infrastructure company Kinder Morgan to sell its Texas natural gas portfolio for $1.8 billion in early 2024.

NextEra Energy Partners has a large renewables portfolio and the backing of NextEra Energy. With a transition plan already in place, the stock -- now yielding 14.5% -- looks to be worth buying for the long term.

Cognex will get back to growth; the only question is when

Lee Samaha (Cognex): The stock of machine-vision company Cognex is down 22% so far this year and 61% from its all-time high. In my view, the share price decline reflects the market's near-term thinking more than a judgment over the company's long-term growth prospects.

The company's three main end markets are consumer electronics (Apple is a significant customer because machine vision helps guide and check smartphone screen layering), logistics (e-commerce warehousing is monitored using machine vision), and automaking (machine vision is used in manufacturing).

Unfortunately, all three markets have come under pressure in 2023. High interest rates hit consumer discretionary spending on electronics, spending on e-commerce warehousing corrected after a period of pandemic-inspired torrid growth, and automakers are also under pressure to scale back production plans.

But all it will take is better news on inflation, and the interest-rate cycle will turn, leaving investors scrambling to increase their outlook for companies like Cognex that rely on their customers' spending plans.

History suggests that when that happens, Cognex's growth could be rapid. All it will take for analysts to raise their forecasts again are a few large orders from, say, a consumer electronics company looking to launch a new product and improve its manufacturing quality using Cognex's machine vision.

If you can be patient and ride out the potential for bad news in the near term, then Cognex is a highly attractive stock for long-term investors.