Last week President Trump reportedly singled out Haiti, El Salvador and African nations as "shithole countries" whose people were not the kind of immigrants the United States wanted. At the time, I happened to be in Serekunda, Gambia's largest urban area, as Trump's slur shocked people across Africa. The anger was palpable.Trump denied saying it, but the reports led to a cascade of swift condemnation, including a United Nations spokesman describing the president's comments as "racist." The African Union, an organization of 55 nations, expressed "outrage" and said it "strongly believes that there is a huge misunderstanding of the African continent and its people by the current [U.S.] administration."But as the fallout continues, there is something missing from the conversation: Trump's alleged vulgar insult comes at a time of strategic shift in Africa — toward China. In the past few weeks I have been on the ground in West Africa, and everywhere I have gone I have seen the presence of China.As America has become an increasingly unwelcoming place for young Africans, they look elsewhere in search of a better life. Last week I visited the Confucius Institute in Dakar, a huge building located on the grounds of Senegal's University of Dakar. I spent time with students from across Africa coming to learn Mandarin as a way to land a dream job in China or take a slice from the growing Chinese presence in every corner of the continent.In the past, they might have sought to study in Europe or the United States. But those places have put up barriers that make it tough to get student visas. Mamadou Fall, the director of the Dakar Confucius Institute, says that the roughly 500 students it teaches find it nearly impossible to get student visas to the U.S. or Europe. But China is happy to oblige them — it now offers Senegalese students free visas and offers 60 of the brightest students from the institute full scholarships to China each year.China's mammoth investment in infrastructure is a key part of its arsenal. As part of the One Belt, One Road strategy, the Chinese are building roads, ports, dams, railways and other infrastructure across Africa. These include a metro system in Addis Ababa, Ethiopia, and a vital railway connecting landlocked Ethiopia's 100 million people to Djibouti's Red Sea port, where the Chinese plan to open their first military base outside China. In Kenya, they financed the biggest post-colonial infrastructure project in the country: a nearly $4 billion railway linking Nairobi with the country's main Indian Ocean port in Mombasa. China is also building a major train network in Nigeria.Attitudes toward the U.S. have changed in Africa since Trump took office, according to a Pew poll in June. Although Trump's strongman act remained popular in Nigeria, the pollster said, "the intensity of positive opinion has waned" in other sub-Saharan countries surveyed, compared with 2015. What's more, Trump's popularity is nowhere near that of the previous Republican president, George W. Bush.Trump's comments disparaging Africans, along with his administration's travel ban and the threat to cut aid to African nations that voted in the U.N. against Trump's Jerusalem decision, send a clear message: The United States is retreating from the post-1945 international system it created, taking an "America First" position on global issues. China is stepping into the vacuum created by Trump in Africa — and almost everywhere else.The danger for the U.S. is that Trump's insulting words make China an even more enticing partner for African nations. This is a moment of opportunity for the Asian giant. Trump's apparent disrespect may push African nations — and the young Africans who represent their future — further into China's arms.The one area America has shown growing interest in Africa is on the military and counter-terrorism front. Trump might be uninterested in Africa's potential, but he has ramped up America's military engagement on the continent. Trump is playing by the usual Africa playbook, which frames the continent as a place of wars, famines and disease rather than a tapestry of nations and cultures. We Africans have long faced the idea of being from an undesirable continent — a place caricatured for centuries for its nightmares and beauty. The Chinese, however, seem to recognize the potential of the fastest-growing continent on the planet.I felt the sting of the president's words last week. I am from Somalia — one of the "shithole countries." But being on the ground in Africa the past few days, I also felt something else, something that may one day be understood as a turning point. Years from now, when you ask Africans when they lost faith in America, don't be surprised if they tell you it was the day a U.S. president labeled their country a "shithole."Ismail Einashe (@IsmailEinashe) is a British-Somali freelance journalist.Editor's note: NPR has decided in this case to spell out the vulgar word that the president reportedly used because it meets our standard for use of offensive language: It is "absolutely integral to the meaning and spirit of the story being told." Copyright 2018 NPR. To see more, visit http://www.npr.org/.