The first half of 2022 was brutal for many popular companies and indexes. The two largest U.S. companies, Apple (AAPL 0.55%) and Microsoft (MSFT 1.63%), are down over 19% and 24% year to date, respectively, as of July 18, and the S&P 500 -- which many investors use to gauge how well the broader economy is doing -- is down more than 20%.

Even though many great companies and the major indexes have had a rough year, you shouldn't be discouraged or distracted from your long-term goals. Bear markets are a natural part of the stock market; they've happened often in the past, and there's no reason to think they won't continue happening in the future.

Nobody likes seeing their portfolio's value decrease, but the one thing you don't want to do in a bear market is get impatient and make short-term moves that go against your long-term interest. It can be costly.

Selling now can stop future gains

If you're investing in a company for the long term, the plan should be to make consistent investments to increase your position in the stock over time. If you panic-sell shares during a bear market, those are shares that you're not giving a chance for future growth. Let's take a look at American Express (AXP 2.63%) (AMEX), for example.

In February 2020, AMEX's stock price fluctuated within the $130 to $135 range, but by March 20, 2020, the stock had decreased to just above $74.

Let's imagine you owned 100 shares of AMEX and sold them for $90 each as you saw the stock plunging, pocketing $9,000. Those same 100 shares would be worth over $14,200 as of July 18, 2022, even with AMEX's stock down more than 15% year to date.

Aside from the potential value missed in a stock price increase, panic-selling your shares can cause you to miss out on dividend payments. With a $0.52 quarterly dividend, those 100 shares could generate $208 in dividend income that could be reinvested into the stock to add to the effects of compound interest. Dividends are a way companies reward investors for holding onto their stock, and if you believe in a company's long-term potential (which you should if you're investing in it), you should do just that.

Uncle Sam will need his share

Another consequence of prematurely selling your shares in a bear market is the potential tax bill it could create. If you've held a stock for less than a year and sell it, any profits you make will be taxed at your regular income rate. If you've held the stock for more than a year, you'll get a more favorable capital gains rate, but it's still taxes owed nonetheless.

Finding yourself selling shares because the price is dropping and owing taxes on the sale could possibly add insult to injury. If you bought the 100 AMEX shares mentioned above for $60 each and sold them for $90, the $3,000 you made in profit would be taxed. At the 15% capital gains rate many people pay, that's $450 owed.

Look at it as an opportunity

By no means is it a guarantee that all stocks will weather the bear market storm, but history has shown that blue-chip companies and major indexes tend to make it through and produce good long-term results. Instead of letting bear markets discourage you, use them as a chance to grab some of your favorite stocks at a "discount" and lower your cost basis. If you're able to lower your cost basis, you increase your potential profits when you eventually sell your shares in the future.