Design comparison
Solution retrospective
Hi, In this challenge I learned a lot about working with async data, and my conclusion is that dealing with them gives you a headache some times! But at least it was fun. There is a thing that I wasn't able to do, in the original design the buttons of the border countries have their full common names, but the API just gives you their abreviations, so i just left them that way, why? Because the only way that i can think for displaying their full names is that i have to fetch again the api using the abreviations of their names, and i think that is a waste of resources and unnecessarily complicated for just that purpose, so if anyone knows a better/simpler way of doing it please share your knowledge with this peasant!
(There's no more free advanced challenges so im sad now, when i really feel that im learning is when i do these challenges 😥)
Community feedback
- @J-e-s-sePosted about 2 years ago
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 helpful1@KTrick01Posted about 2 years ago@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!
0 - @denieldenPosted about 2 years ago
Hi Eduardo, congratulations on completing the challenge, very great job! 😁
Some little tips for optimizing your code:
- add and use inside
a
thearticle
tag to the container card for improve the Accessibility - remove all unnecessary code, the less you write the better as well as being clearer: for example the
picture
tag container of flag images - use
ul
element for the details text of country instead of multiplep
- I would also add a query reset button, I find it very convenient
Hope this help! Happy coding 😉
Marked as helpful0@KTrick01Posted about 2 years ago@denielden Hi! I think I applied all of your advice. Thank you for your feedback!
1 - add and use inside
- @elaineleungPosted about 2 years ago
Hi Eduardo, I tried to access the site on my desktop and also on my phone, but it's just stuck in the loading state where I can only see the header but not the content. Maybe the other commenters managed to see it, or maybe I need to try another browser? (I'm using Firefox.) In any case, I would suggest you try what @J-e-s-se mentioned, and hopefully that helps you out in displaying the full country name.
By the way, maybe you can try the pro membership for a month and see what projects you can build? I'm on a monthly plan right now, and even though I haven't finished the free projects, I do think the pro projects are worth checking out and building.
Anyway, hope I can see the page later!
1@KTrick01Posted about 2 years ago@elaineleung Hi Elaine! Thanks for your feedback! Actually, I always use Firefox to do the challenges so it's weird that it wasn't loading for you, but now i changed some things so i think it will work just fine now.
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord