It's no secret that the stock market has been struggling of late due to various marketwide issues. It can be difficult for investors to remain calm in times like these. Resorting to panic selling can be tempting, but it is rarely the right move. History teaches us that the stock market will recover in the long run, and so will shares of great companies.

That's why buying stocks during a downturn can be a great move. Let's look at two companies that have been hammered in the market lately but remain excellent picks for investors focused on the long game: Airbnb (ABNB 1.01%) and Amazon (AMZN 3.61%).

ABNB Chart

ABNB data by YCharts

1. Airbnb

Airbnb's business didn't perform well during the pandemic's peak. The company provides a platform that helps travelers book home rentals and experiences. Traveling wasn't exactly on people's minds during the early days of the outbreak. But Airbnb has rebounded nicely since then, as evidenced by its strong financial results. In the first quarter, the company's nights and experiences surged 59% year over year to 102.1 million.

This metric even came in above its pre-pandemic levels, growing 26% compared to the first quarter of 2019. Meanwhile, the company's revenue of $1.5 billion jumped 70% year over year and increased by 80% compared to the comparable period of 2019. The company isn't consistently profitable yet. But Airbnb's $19 million net loss for the quarter was still a lot better than the net losses of $1.2 billion and $292 million reported during the comparable periods of 2021 and 2019, respectively.

Family walking up to the front door of a house.

Image source: Getty Images.

Thankfully, there are plenty of opportunities ahead to help Airbnb grow its top and bottom lines. The pandemic is still with us, but it seems to be subsiding. The travel industry will continue to see increased activity, and that's good news for Airbnb. In the press release announcing its first- quarter results, the company said: "Looking ahead, we see strong sustained pent-up demand. As of the end of April 2022, we had 30% more nights booked for the summer travel season than at this time in 2019, and the growth from 2019 is higher the further we look out this year."

Also, many more people now work from home, and the flexibility allows them to take their work on the road. Airbnb offers convenient (and often cheaper) alternatives to traditional hotels that helps its customers to feel at home. Bookings of 28 days or more are the fastest-growing category for the company compared to 2019. There is at least one thing that will help Airbnb remain a leader in this industry, namely its competitive edge.

The more renters on its platforms, the more potential travelers looking for places to stay will gravitate toward it, and vice-versa. This network effect (when the value of a service increases when more people know of it) combined with the growing demand for home rentals and experiences paint a bright future for Airbnb. In short, adding shares of this tech stock on the dip is a great idea.

2. Amazon

Investors were not pleased with Amazon's latest update. The company's net sales increased by an unimpressive (especially by Amazon's standards) 7% year over year to $116.4 billion. The tech giant also reported a net loss of $3.8 billion compared to the net income of $8.1 billion recorded during the first quarter of 2021. 

One reason behind Amazon's lackluster performance is that people are less reliant on e-commerce than they were during the pandemic's peak. The company's sales suffered as a result. Further, Amazon is dealing with global supply-chain pressures and inflation, issues that contributed to a rise in expenses.

However, it's essential to look at those headwinds in context. Amazon's sales soared abnormally during the pandemic as people turned to online shopping. The fact that Amazon cannot keep up with the pace it set during the worst of the outbreak is to be expected. Also, while economic problems will continue to weigh on the company in the short term, these issues are temporary. And there are good reasons to remain optimistic about Amazon's long-term prospects.

For instance, the company's high-margin cloud computing business -- Amazon Web Services (AWS) -- is still booming. AWS' net sales increased by 36.6% to $18.4 billion during the first quarter. The segment's operating income soared by 56.6% to $6.5 billion. By contrast, Amazon's other two units reported operating losses. Cloud computing still has a long runway for growth. That's great news for Amazon, which is one of the leaders in this space.

As this unit makes up a larger share of its top line, the company's margins will benefit. Amazon's e-commerce business should recover, too. Its online sales growth should stabilize once pandemic-related dynamics are in the rear-view mirror. Looking at the big picture, Amazon is still well-positioned to perform solidly in the long run. That's why investors should stay put and avoid the urge to resort to panic selling.