It's always best to enter the stock market with a long-term mindset. Doing so can safeguard your investment from temporary headwinds like the ones that occurred last year amid an economic downturn. For instance, the Nasdaq Composite index plunged 33% in 2022. However, easing inflation has boosted the index by 21% year to date, leading it to grow 72% over the last five years despite recent challenges.

As a result, investors who pulled out during market lows in 2022 will not be benefiting from its gradual recovery this year. 

Along with a long-term perspective, it's prudent to choose stocks in companies that have significant market share in growing industries, as market development can almost guarantee long-term stock growth. 

Here are three attractive stocks to hold for the next 20 years. 

1. PayPal

PayPal (PYPL -1.83%) has fallen out of favor in recent years after ending a long-term partnership with eBay in 2018, then experiencing steep losses in 2022 from macro challenges. The hurdles haven't been helped by expanding competitors like Adyen and Cash App. Meanwhile, tech giants like Apple and Alphabet have shifted to using in-house payment services. 

However, not all hope is lost for this fintech company. Despite recent difficulties, PayPal revenue climbed 55% since 2019, from $17.7 billion to $27.5 last year. Meanwhile, operating income has increased by 41% from $2.7 billion to $3.8 billion. 

The company's consistent earnings, alongside investor doubt, make its stock a bargain. PayPal's price-to-earnings ratio of 12 decreased by almost 40% in the last year, presenting a buying opportunity. As inflation continues to ease and the e-commerce market recovers, PayPal could offer significant gains to investors willing to hold for the long haul. 

2. Disney

Disney (DIS -0.45%) shares are down 11% year over year after repeated hits to its business, with the COVID-19 pandemic stunting income from box office and theme park attendance for nearly two years. Then, last year's economic tumble made it costly for the company to expand its flagship streaming service, Disney+. 

The challenges led to a string of budget cuts, with CEO Bob Iger announcing a plan to target $5.5 billion of cost savings in February. Most of the cuts are being made to content spending, with Disney also projected to cut 7,000 jobs this year. However, decreased spending on content is positive, considering the biggest red flag over the last year has been the company's direct-to-consumer (DTC) business, which includes streaming revenue.

The cuts seem to have Disney on a growth path, with its DTC segment reporting a 12% year-over-year rise in revenue in the second quarter of 2023 and operating losses improving by 26% despite subscription losses during the quarter. Alongside a consistently thriving parks business, Disney shares are currently trading at a compelling price point. The company's price/earnings-to-growth (PEG) ratio of 0.7 indicates projected growth is not priced into its stock, suggesting now is an excellent time to consider investing.

Disney celebrates a century of business in 2023, with its stock rising 39% over the last decade. Despite recent setbacks, the company continues to be the king of entertainment, making it a stock you can buy now and hold indefinitely. 

3. Amazon

Like PayPal and Disney, Amazon (AMZN -1.14%) suffered steep losses last year. Its e-commerce segments reported combined operating losses of $10.6 billion in 2022. Meanwhile, the first quarter of 2023 showed signs that inflation hikes forced businesses to slash cloud budgets as Amazon Web Services (AWS) experienced slowing growth. However, the company's long-term outlook remains strong alongside its dominating positions in online retail and the cloud market. 

According to data from Statista, the e-commerce market is projected to hit $4 trillion this year. That figure is even while online purchases only made up about 15% of all retail sales in 2022. The sector's growth is immensely promising for Amazon as it holds a leading market share in e-commerce in multiple countries. 

Additionally, a current boom in AI suggests the cloud market could receive a massive boost in the coming years. The potential has prompted Amazon to invest nearly $13 billion in expanding AWS in India by 2030. The move could offer the company substantial gains over the long term, considering India is the world's second-largest internet market and growing rapidly.

Amazon has vast potential in two high-growth markets, making its stock an exciting option to buy now and hold for the next 20 years.