A stock market sell-off in 2022 that saw the Nasdaq Composite index slump 33% over 12 months left many companies starting the new year in the doldrums. However, temporary headwinds like economic challenges are precisely why investing in stocks with a long-term mindset is crucial. Holding stocks over many years can make short-term declines inconsequential and keep your portfolio growing. 

Amazon (AMZN -1.14%) and Warner Bros. Discovery (WBD -4.47%) experienced steep declines in their stocks last year, and their shares are still down more than 39% year over year. Here's why I'm not worried about their stock dips and why Amazon and Warner Bros. Discovery remain no-brainer buys. 

Amazon

Amazon's stock plunged 50% in 2022 as its e-commerce business suffered from reduced consumer spending. The company's shares have slightly recovered since the start of the year; however, they are still down 39% year over year. 

Despite the decline, Amazon remains a solid business worth investing in over the long term. Even after its recent declines, the stock is up 23% over the last five years and 593% over the last 10 years. Anyone who invested in Amazon shares five-plus years ago and chose to hold is still up on their investment.

Recent times have been challenging. Amazon's e-commerce segments reported combined operating losses of $10.6 billion in fiscal 2022 as foreign exchange fluctuations and rising inflation challenged the online retail business. However, e-commerce should remain a lucrative industry over the long term. According to Statista, online retail sales made up 19.7% of all worldwide sales in 2022, with that figure up from 7.4% in 2015 and it's expected to hit 24% in 2026.

Meanwhile, Amazon's leading 37.8% market share in e-commerce in the U.S. makes it well-positioned to significantly profit from that growth. By comparison, Walmart stands at a distant second with a 6.3% market share.

While the e-commerce market still has plenty of room to grow once economic headwinds inevitably subside, Amazon's cloud computing platform, Amazon Web Services (AWS), is the best reason to invest in its stock. The service holds a leading 34% market share in the cloud industry, projected to expand at a compound annual growth rate of 14.1% through 2030.

With AWS reporting a 28.8% year-over-year rise in revenue of $80.1 billion in fiscal 2022 and $22.8 billion in operating income, I do not doubt that Amazon can overcome the economic challenges burdening its e-commerce business and flourish over the long term.

Warner Bros. Discovery 

Warner Bros. Discovery shares sank 63% in 2022 after the company took on $43 billion in debt from a costly merger and then underwent an expensive restructuring. The stock has now soared 60% since Jan. 1 as investors have grown optimistic about the company's future. However, Warner Bros. Discovery still has a lot of work ahead as its stock remains down 45% year over year.

The entertainment giant has had a rocky start, but its valuable content library will likely take it far over the long term. Warner Bros. Discovery is home to franchises such as Harry Potter, The Lord of the Rings, DC, Game of Thrones, and many other beloved series from HBO. However, the most exciting part of its bevy of content is that the company finally seems well-equipped to use these franchises to its full advantage after years of missteps. 

For instance, the Harry Potter franchise relaunched in 2016 with the release of the first Fantastic Beasts film, which has had three installments, each earning less at the box office than the one before as interest has dwindled. However, Warner Bros. Discovery released the Harry Potter-themed video game Hogwarts Legacy on Feb. 10, which became an overnight sensation, earning $850 million and selling 12 million units in its first two weeks.

The game has breathed new life into the franchise. Online engagement with Wizarding World Digital, a portal for all things Harry Potter, soared 300% in the first 10 days of February. The renewed love of J.K. Rowling's creation will likely trickle down to Warner Bros. Discovery's films, theme parks, and merchandise sales, with rumors of a Hogwarts Legacy TV series already being discussed for HBO Max, providing a potential boost to streaming subscriptions. 

And it's not just Harry Potter seeing a renewal of sorts. Warner Bros. Discovery has plans for more Lord of the Rings films, a relaunch of its DC films series, and subsequent seasons of its Game of Thrones spin-off, House of the Dragon

Warner Bros. Discovery's stock is still down significantly year over year, but its plan to continue expanding its beloved franchises with a focus on quality will likely see its stock soar over the long term.