JOHANNESBURG — Years of rapid economic growth across sub-Saharan Africa fueled hopes of a prosperous new era. To many, the world’s poorest continent was finally emerging, with economies that were no longer dependent on the fickle global demand for Africa’s raw resources.

But as China’s economy slows and its once seemingly insatiable hunger for Africa’s commodities wanes, many African economies are tumbling, quickly.

Since the start of this year, the outlook across the continent has grown grimmer, especially in its two biggest economies, Nigeria and South Africa. Their currencies fell to record lows this month as China, Africa’s biggest trading partner, announced that imports from Africa plummeted nearly 40 percent in 2015.

“We can see what drove the growth in Africa when demand goes away,” said Greg Mills, the director of the Brenthurst Foundation, a Johannesburg-based economic research group. “Well, demand has gone away, and it’s not pretty.”