This would have been my response to the this ^ reply. They have capital to spare and also, what they're gaining from these countries in return more than justifies there loss in capital. the gain exclusive rights to ports and military presence. recently they made a an effort to include African countries as their allies. Concluding that they will allow African countries to retain control over there capital wand profits while allowing china to export their natural resources. this is attractive for African nations.
It’s worth noting that while some of the dud Chinese loans are for resources and whatever there are also plenty of nonperforming loans for projects that couldn’t possibly be useful to China, like the Montenegrin highway to nowhere: https://www.rferl.org/a/montenegro-billion-dollar-chinese-hi...
One other interesting note is that the way the financing is structured, the loans are not coming from the Chinese state but state owned banks, which seems like a mostly pedantic distinction, except the state owned banks also do much of the normal lending activity within China itself. Those banks now face the double whammy of dud property loans domestically and these dud loans to other countries, which is not helping the Chinese economic slowdown.