A series of unusual national and global events over the past few years helped make the stock market even more unpredictable than it normally already is. But even with that increased unpredictability, at least one market truism remains: Investors who buy shares of strong companies with opportunities for more growth tend to set themselves up for success if they maintain a long-term investing mindset.

The long-term growth in a business is more predictive of future returns than any short-term changes (good or bad) a stock might experience. With that long-term investing mindset in mind, here are two stocks that still have enormous upside over the next decade and beyond.

1. Tesla

Tesla (TSLA -1.11%) stock has been a phenomenal performer for investors over the last decade. The stock price recently pulled back over worries about the negative impact of rising interest rates on car sales. Still, CEO Elon Musk has proven to be a leader we shouldn't underestimate.

The company's third-quarter earnings report doesn't help the bull case for the stock. Tesla reported a 5% year-over-year increase in automotive revenue in the third quarter, which is lower than the second quarter's increase of 46%. Moreover, Tesla's recent price cuts are pressuring its profitability; its operating margin fell to 7.6%.

Tesla's business is susceptible to swings in the economy, especially as it gains a greater share of the car industry. However, Tesla's real value is not in the cars themselves but in the technology that powers their autonomous capabilities. For example, Musk told analysts on the Q3 earnings call that the price of Tesla's full-self-driving car software, which currently costs $12,000 as an add-on, could gradually increase proportionately with its value.

Musk also noted that investments in artificial intelligence (AI) technology will be the company's real difference-maker in the long run. AI stretches Tesla's opportunity to other products that could change the world and rapidly increase economic productivity, such as humanoid robots. "If you have fully autonomous cars at scale and fully autonomous humanoid robots that are truly useful, it's not clear what the limit is," Musk said. This is why Musk believes Tesla can become the most valuable company in the world.

Tesla still has an enormous runway of growth. If you haven't bought shares yet, the recent pullback makes this a great time to consider starting a small position for the long term.

2. Cloudflare

Cloudflare (NET 1.44%) offers performance-enhancing features and security for websites. It's estimated that Cloudflare serves about 20% of all internet traffic. Many of the world's largest companies use its network, but the stock is trading well off its previous highs as Wall Street worries about slowing growth in the near term. It's a great opportunity to add this fast-growing business to your portfolio.

Revenue grew 32% year over year in the most recent quarter, but that was well off the previous pace when Cloudflare was consistently reporting top-line growth of more than 40%. That level of growth points to a tremendous opportunity ahead. In fact, Cloudflare appears to be well-positioned to benefit from the increased demand likely to come from growing (AI) workloads.

AI workloads are going to increase substantially in the years to come. Much of that processing is going to take place on a device close to the end user, which means Cloudflare could realize savings by spending less capital on equipment, such as the latest graphics processing units (GPUs). These savings could boost the company's profit margin.

Like Tesla's, Cloudflare's near-term downside pales in comparison to its long-term upside potential. Cloudflare currently generates only $1.1 billion in trailing-12-month revenue, and it has a small share of a growing $146 billion addressable market.

Cloudflare can grow at high rates for many years. Moreover, its operating margin of 6.6% is well below management's long-term target of 20%. The stock should be worth a lot more in 10 years than it is today.