Many tech stocks, especially shares of companies that benefited from stay-at-home trends, soared in value throughout the pandemic last year. But that trend reversed over the past few weeks, as higher bond yields and lower COVID-19 infection rates sparked some investors to begin a rotation from growth stocks to value stocks.

As this paradigm shift continues, many investors might be tempted to sell all their tech stocks and buy cheaper reopening plays across the retail, energy, and travel sectors.

But investors need to avoid throwing out the baby with the bathwater as they navigate the currently choppy market. It would certainly be prudent to reduce your exposure to some of the frothier tech stocks, but most investors should still retain some exposure to the tech sector for three reasons.

Software developers work in a transparent office with a digital background.

Image source: Getty Images.

1. Secular growth stories

The tech sector is filled with secular growth stories, which profit from disruptive long-term trends, instead of cyclical ones that are tightly tethered to macroeconomic cycles. Trends like 5G communication networks, cloud computing, artificial intelligence, cybersecurity, driverless cars, e-commerce, social networks, and augmented reality are all long-term secular growth stories that could disrupt older markets.

Widespread adoption of 5G networks will enable cloud services to deliver data at faster rates, which will enable companies to gather and crunch more data, automate their industrial machines more effectively, and enable more on-premise software to be offered as services.

The acceleration will support the growth of cloud gaming platforms, make driverless cars and autonomous delivery drones more efficient, render many older jobs obsolete, and pave the way for new jobs that rely more on knowledge than repetitive tasks and manual labor. They'll also move more offline tasks -- such as banking, shopping, and socializing -- online.

Solid long-term plays on these secular trends include Amazon (AMZN 3.29%), the world's top e-commerce and cloud platform company; salesforce.com (CRM 0.32%), the pioneer in cloud-based customer relationship management (CRM) services; Taiwan Semiconductor Manufacturing (TSM 1.09%), the world's largest and most advanced contract chipmaker; and online payments giant PayPal Holdings (PYPL 2.71%).

2. A history of outperforming the market

All four of those stocks easily crushed the S&P 500 over the past five years:

^SPX Chart

Data source: YCharts

Past performance never guarantees future gains, but I believe these four tech giants and many of their peers should continue to outperform the broader market, which includes slower-growth companies that are more sensitive to macroeconomic headwinds.

That's because demand for all these tech companies' products and services should continue rising over the long term. For example, the global cloud computing market could still grow at a compound annual growth rate (CAGR) of 27.9% between 2020 and 2025, according to research company MSR Group.

The online payments market could expand at a CAGR of 23.7% between 2020 and 2027, according to Fortune Business Insights. The global semiconductor market -- which already faces several chip shortages today -- could grow at a CAGR of 10% from 2021 to 2026, according to research company EMR.

We should take those long-term forecasts with a grain of salt, but they all suggest top tech companies will remain resilient throughout economic downturns as long-term demand for their products and services rises.

3. Plenty of choices between value vs. growth

The tech sector might still seem overheated, but that's only because investors are willing to pay a premium for high-growth stocks. That's why the cloud services company Snowflake (SNOW 3.58%) still trades at nearly 50 times this year's sales: Investors are still willing to pay that frothy price-to-sales ratio for a company that could grow its top line 85% this year.

But the tech sector is also filled with mature tech stocks like Oracle (ORCL 2.56%), which trades at just 15 times forward earnings while paying a forward dividend yield of 1.4%. Oracle is growing at a much slower rate than Snowflake, but it also owns a resilient cloud business which will profit from the same secular shift from on-site software toward cloud-based services.

Simply put, not all tech stocks are frothy and speculative investments. Investors who have a lower tolerance for risk can simply invest in Oracle or other slower-growth blue chips instead of completely avoiding the sector.

The bottom line

Some investors might avoid tech stocks because they don't understand the underlying businesses. That's perfectly fine, and that trading strategy follows Peter Lynch's mantra of buying "what you know" instead of chasing hot stocks.

But investors who do some homework will realize that understanding most tech stocks doesn't require any knowledge of coding or engineering. Instead, it requires a grasp of disruptive technologies and how they expand. Once you understand those concepts, it becomes easy to see why tech stocks still belong in most long-term investment portfolios.