@J-e-s-se
Posted
You don't need to re-query the api. Here's a function from my solution on how to get a country name using it's abbreviation.
const getCountryName = (a3code: string) => { const country = countries.find((c) => c.alpha3Code === a3code) return country ? country.name : '' }
const name = getCountryName('ALB') console.log(name) // albania
Marked as helpful
@KTrick01
Posted
@J-e-s-se Hi Jesse! Thanks for your feedback! I ended up using your function, but due to how I handled the fetching it was necessary to re-query the API, because my countries details component only has access to the data of the current country, not to all of the countries, i'll change that later!