After taking a hammering in June, China's stocks and currency are off to a rocky start to July.

Fears over a slowdown in the country's economy and the start of a trade war with the United States have been weighing on Chinese shares and the yuan.

The benchmark share index in Shanghai, which entered a bear market last week, is trading near its lowest level in more than two years. The yuan hit its weakest level against the dollar in 11 months on Tuesday before bouncing back amid reports that the government had intervened to support the currency.

A weaker yuan could help Chinese exporters by making their products cheaper, but also risks increasing trade tensions with the Trump administration.

Previous big plunges in the yuan in recent years have wreaked havoc in Chinese and global stock markets. The Chinese government said Tuesday it wanted to keep the yuan stable.

Other emerging market currencies have also fallen against the strengthening dollar. But the strong dollar "is less of a valid argument" for the yuan's recent declines, according to Tai Hui, chief market strategist at JPMorgan Asset Management in Asia.

The yuan has also been losing ground against the currencies of China's other major trading partners, like the euro.

The question is how much further, and how quickly, the yuan might fall.

"There is undoubtedly cause for concern, but not alarm on the prospects for the Chinese yuan," Aninda Mitra, a senior analyst at BNY Mellon Investment Management in Singapore, said in a note Tuesday.

He acknowledged that in a trip to Shanghai last week, he "detected increasing alarm over trade tensions and a lot of nervousness about a full blown trade war, which comes at a bad time for China, where the economy is undergoing a downdraft at precisely the same time the United States is seeing a sharp upturn."

Washington and Beijing are set to impose tariffs on tens of billions of dollars of each other's exports on Friday, prompting fears of a tit-for-tat escalation.

This is what a trade war looks like

Analysts generally reject suggestions that China could use the weaker yuan as a weapon in the trade clash. They point to the chaos caused in Chinese and global markets by sharp falls in the currency in 2015 and early 2016.

"This is not a can of worms that Beijing wants to open again," Hui said.

Instead, analysts expect the Chinese government to intervene to prevent the currency plunging too rapidly.

In a statement posted on the Chinese central bank's website Tuesday, Governor Yi Gang said it's "paying close attention" to recent fluctuations in the market and will seek to keep the yuan stable at a reasonable level.

After falling around 0.8% against the dollar early on Tuesday, the yuan recouped its losses in afternoon trading, moving into positive territory. Some reports cited traders as saying that big Chinese state-owned banks, which sometimes act on behalf of the central bank, were buying the yuan.

The People's Bank of China, which helps guide the yuan by setting a daily trading range, didn't immediately respond to a request for comment.

If Chinese authorities struggle to keep the yuan under control, the problems could spread.

"Continued pressure on China's [currency] and equity markets amid further worsening of sentiment constitutes a key risk for markets in China and elsewhere," Louis Kuijs, head of Asian economics at research firm Oxford Economics, wrote in a note to clients on Friday.

Chinese stocks have also been volatile.

The Shanghai index dropped 2.5% on Monday and was down more than 1% on Tuesday morning. It recovered later in the day, closing up 0.4%.