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.” The International Monetary Fund has in recent months sharply cut its projections for the continent. Credit rating agencies have downgraded or lowered their outlook on commodity exporters like Angola, Ghana, Mozambique and Zambia, which were the darlings of international investors until just over a year ago. Many economists expect South Africa, the continent’s most advanced and diversified economy, to slide into a recession this year, a projection disputed by the government. As Africa’s biggest exporter of iron ore to China, South Africa is suffering from a slump in mining, as well as in other sectors like manufacturing and agriculture. Like the currencies of many commodity-exporting nations, South Africa’s rand has declined sharply in recent months because of the worldwide fall in prices of raw materials and because of poor government policies. The weak rand will make it more painful for South Africa, which is experiencing the worst drought in a generation and is usually an exporter of agricultural products, to import corn, the nation’s staple. Higher food prices could pose a challenge to the government of the nation’s president, Jacob Zuma, who is confronting widening public anger over rising income inequality and whose party, the African National Congress, is expected to face serious challenges in municipal elections this year. Nigeria, Africa’s biggest economy and oil producer, is reeling from the crash in crude prices, at the same time President Muhammadu Buhari tries to deal with Boko Haram, the Islamic extremist group that has long terrorized the nation. With oil accounting for 80 percent of government revenue, the government may also lack the resources to quell potential unrest in the Niger Delta, the source of the country’s oil. Nigeria’s currency, the naira, collapsed to record lows this month after Nigeria’s central bank placed restrictions on the sale of American dollars to protect its shrinking foreign reserves. The currency fell to about 300 naira to the dollar in Nigeria’s black market, down from about 240 early last month. Weakening currencies will make it harder for Nigeria — and many other African governments — to repay China for loans used to build large infrastructure projects. The tumbling naira and China’s downturn are also reverberating across private businesses, large and small. Happiness Awonegbe, a businessman in Lagos, Nigeria, whose companies import paper, tires and other goods from China, said the restrictions on the dollar had made it difficult for him to place orders with Chinese suppliers. When he can place an order, his Chinese suppliers now take 50 days to fill it instead of 30, apparently because of reductions in their workforce, Mr. Awonegbe said. “We are feeling so much this spillover effect,” said Mr. Awonegbe, who employs 50 people. “What happens in China affects Nigeria.” As the slumping economies have underscored the continent’s growing vulnerability to changes in China, they have quieted much of the heady talk of “Africa rising,” a catchphrase that symbolized the continent’s fortunes. Growing consumer demand and an emerging middle class, while real in many African nations, are insufficient to offset a fall in the continent’s main driver of growth, which remains commodities. But experts also see bright spots on the map. While previously high-flying commodity exporters, like Angola and Zambia, have been hit hardest by China’s slowdown, other countries are showing greater resilience. “The ‘Africa rising’ narrative wasn’t true, but neither is the diametrically opposed argument that Africa is no longer rising,” said Simon Freemantle, a senior political economist at Standard Bank, a South African bank. “The truth is obviously in between.” “What we’re going to see going forward is far more fragmentation and divergence across the continent,” Mr. Freemantle added. “And what’s going to determine that divergence is how prudent countries have been during the good times. Have they embedded macro reforms? Have they saved?” Mr. Freemantle said East African countries, including Kenya and Ethiopia, which have been forced to diversify their economies in part because of their dearth of commodities, will probably continue to enjoy robust growth. Even Nigeria, which remains dependent on oil, has experienced growth in other sectors in the past decade. A rising middle class has led to the emergence of Western-style shopping malls. A booming entertainment industry helped Nigeria overtake South Africa as the continent’s biggest economy in 2014. Still, experts say, most nations failed to take advantage of the boom years to carry out long-term changes to their economies. They failed to deal with some of the biggest obstacles to sustained growth — like the severe lack of electricity across the continent — and spur industries that would create jobs. In South Africa, where a chronic shortage of power has constrained the economy, the unemployment rate hovers around 25 percent. Zambia, whose economy depends on copper exports, has suffered from waning demand from China and a drop in copper prices. Mines have closed, and thousands of jobs have been lost in recent months. Critics say Zambia could have taken advantage of the boom by negotiating better terms with Chinese companies, including securing technology transfers or employment for infrastructure projects. Zambia used revenue from copper to increase the salaries of civil servants but did not invest in potential growth industries, like tourism and agriculture. Edith Nawakwi, a former finance minister in Zambia and now leader of an opposition party, said large infrastructure projects were often wasted opportunities that failed to lead to economic development. African leaders, Ms. Nawakwi said, could have asked the Chinese to build infrastructure that would have furthered regional integration, business and trade. “What we need is a change in the way we approach China,” Ms. Nawakwi said. “You get from China what you ask for.” Last month, in a summit meeting here with most of Africa’s leaders, President Xi Jinping of China pledged $60 billion in development assistance to the continent and promised to support “Africa in achieving development and prosperity.” Robert Mugabe, Zimbabwe’s president and the chairman of the African Union, heaped praised on China as a counterpoint to Western powers. Many delegates to the summit meeting said China, unlike the West, treated Africans as equals. But with the impact on Africa of China’s downturn and a growing trade imbalance — China exported $102 billion to Africa last year but imported only $67 billion from the continent — skeptical voices are increasing. “The Chinese are not romantic anymore about their relations with Africa — far from it,” said Ibbo Mandaza, a political analyst and businessman in Zimbabwe. “For them, it’s purely economic.”