The Chinese stock markets have been on a prolonged slide, falling fairly consistently over the last three months, although with occasional "dead cat" bounces as the Beijing government intervenes to boost share prices - initially just by ordering large shareholders not to sell (it's a totalitarian regime, remember) and most recently by devaluing the yuan.
The underlying cause is a hideous mess of macroeconomic interactions across the world. QE in the Eurozone back in February and Japanese QE before that boosted the relative value of US dollar where QE was being tapered just as others were getting started. The Chinese yuan is loosely pegged to the dollar and so its value was dragged up as well, which impacted Chinese exports. Naturally Chinese investors were selling up in China with a view to moving their money somewhere safer, ie the UK and the USA; an order from the Chinese government to stay put and suck up the loses was not reassuring.
Lowering the value of the yuan is easily done. The Chinese set a new value for the yuan vs the dollar every day - the peg is very loose indeed. In one stroke they robbed investors in China of five percent of their assets and removed future incentive to decamp to a safer place. Generally people do not bother locking the door after the horse has gone, and this horse may actually come creeping back over the next few weeks.
Unfortunately devaluing the yuan just pushes the problem back on the rest of the world. At the moment all the G7 countries are attempting "export-led" recoveries. There's a fairly obvious problem with that plan. We can't all be net exporters. For one country to be a net exported another has to be a net importer.
There is another problem. China wants the yuan to be a "reserve" currency like the dollar is and also sterling to a lesser extent. This is more of a prestige thing than any real benefit to China although there is clout to be gained when the world saves in a currency you can magic out of thin air. The US dollar is so popular with the rest of the world that American can print more and more dollars (and spend them on themselves of course) and nothing bad happens domestically. If you try that and your currency is not a reserve currency your name is probably Zimbabwe.
But for your currency to be a reserve currency you must operate a net importer economic model. Foreigners must be able to sell you stuff and get your currency without having to buy stuff from you and give your money back. That way they can keep some of your currency to trade around the world. China is not and cannot be a net importer. Without exports they are nowhere. The great China boom was based on exports. With exports stripped out their economy is much smaller.
So the world is locked in a battle of competitive devaluation with everyone trying to be cheaper than everyone else and America ending up as the buyer who never says no. This means America has and will live high on the hog for decades but one day all the dollars overseas will come home and try to wipe them out.
At which point President Trump will build a wall.