NEW YORK (CNNMoney) -- China's boom has made it a magnet for capital, but investing in the world's second-largest economy is still risky.
"Investing in China is not for the faint of heart," said Tu Packard, a senior economist at Moody's Analytics. "There are opportunities, but it's fraught with risks."
In addition to being risky, investing in Chinese stocks has also been less rewarding over the past few years.
The Shanghai Composite () plunged nearly 22% last year, making it one of the worst performing global markets of 2011. Stocks in Shanghai have been clawing back gains this year, rising more than 8%, compared with a 9% gain for the S&P 500 ( ).
But many Chinese companies remain under pressure, including search giant Baidu (), Aluminum Corp. of China ( ), China Eastern Airlines ( ), China Telecom ( ) and oil company CNOOC ( ).
Investors have been scaling back their exposure to China, as the nation's booming economy lost momentum, although most experts say a so-called hard landing still seems unlikely.
Chinese gross domestic product, the broadest measure of economic activity, rose at an annual rate of 8.1% in the first quarter. That was down from 8.9% in the fourth quarter, and below the historical average of around 10% over the last three decades.
"It doesn't surprise us that the Chinese economy looks soft," said Paul Christopher, chief international strategist at Wells Fargo Advisors. "Their biggest customers are the U.S. and Europe."
China's economy started slowing late last year following government efforts to cool rampant inflation and deflate a bubble in the property market. But the weak European economy and sluggish recovery in the United States have also taken a toll on China's export-driven economy.
Under its latest five-year plan, China is trying to reduce its dependence on exports and boost consumer spending to create more sustainable economic growth.
Investors should also expect some short-term uncertainty as China prepares for a major leadership shift, says Christopher.
On top of that, the Chinese government has been moving away from investments in large-scale infrastructure projects, which could curb the nation's demand for natural resources, he said.
That could prove problematic for U.S. multinationals such as Alcoa (Fortune 500) and Caterpillar ( , Fortune 500), which have been riding the wave of construction spending in China over the past few years.,
Christopher advises investing in China as part of a diversified portfolio of emerging market stocks. "We wouldn't buy stand-alone China exposure," he said.
However, others argue that worries about a slowdown in China are overblown. They say the Chinese government has the resources it needs to support the economy and is willing to act if conditions deteriorate.
"Investors should remain constructive in China," said Xian Liang, senior China analyst at U.S. Global Investors.
Liang pointed out that China has already lowered reserve requirements for banks twice, signaling that policy makers in Beijing remain focused on "fine-tuning" the economy.
What's more, he said the shift toward more domestic consumption presents an opportunity for investors.
"The consumer is certainly a long-term play," said Liang. "It's an area the government wants to promote."
Chinese technology companies are another growth area, analysts say. Social media company Renren () and Sina Corp., ( ) the parent company of microblogging website Weibo, are two examples.
Some Chinese bank stocks are also attractive, despite concerns about loan losses in real estate portfolios, according to Laing.
Still, even savvy investors can get burned in China, since the rules of the game are sometimes subject to change without notice.
Chinese timber firm Sino-Forest filed for bankruptcy earlier this month after being accused of fraud by investment research firm and short-seller Muddy Waters.
The Sino-Forest case highlighted concerns about so-called "reverse mergers," a quick and popular way for Chinese companies to trade publicly on U.S. and other international exchanges.
In a reverse merger, a privately held Chinese company typically merges with a publicly traded U.S. company, gaining voting and operational control without the regulatory hurdles that come with a traditional IPO.
And just this week, China-based oil field services company SinoTech () was sued by U.S. securities regulators for overstating the value of certain assets in documents linked to its initial public offering.
Given the uncertain economic and political outlook, now is a particularly inauspicious time to be investing in China, cautioned Packard.
|What we want Apple to unveil at WWDC|
|Millennials squeezed out of buying a home|
|7 traits the rich have in common|
|Big Data knows you're sick, tired and depressed|
|Your car is a giant computer - and it can be hacked|
|Overnight Avg Rate||Latest||Change||Last Week|
|30 yr fixed||3.36%||3.43%|
|15 yr fixed||2.65%||2.69%|
|30 yr refi||3.40%||3.46%|
|15 yr refi||2.69%||2.73%|
Today's featured rates: