@kremenovicSubmitted almost 3 years ago
Hi,
I would like to know if any of you guys have any idea how to get border countries' names? I was trying but in the end, I gave up and only displayed alpha3Code.
Thanks!
Hi,
I would like to know if any of you guys have any idea how to get border countries' names? I was trying but in the end, I gave up and only displayed alpha3Code.
Thanks!
Hi I had the same problem and got really stuck on it for a while. First I did a check after my initial fetch request for the country that was clicked to see if it had a border property. If it does have a border property the value of it will be an array and you can make another fetch request to https://restcountries.com/v3/alpha?codes=[borders]
and it will return all of the data for those countries that are in that array.
Hope this helps!