Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Rest-country-api-with-theme-switcher-using-react and tailwind CSS

@nikkuv

Desktop design screenshot for the REST Countries API with color theme switcher coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
4advanced
View challenge

Design comparison


SolutionDesign

Solution retrospective


There is much space for improvement for this solution...So I would like to get some valuable feedback...😁 I need help on the second page in "Border Countries" there is the name of the countries but we are getting three letter country code. How do get names for the countries there? If you have any method to do it please tell...Thank you so much.

Community feedback

Jesse 430

@jesse10930

Posted

Hey Saumya, your project is looking good so far! In order to get the full name of the country rather than just the 3-letter country code, you have to find the country name that corresponds to the 3-letter country code from the API.

If I'm following your code correctly, you first store all the data for all the countries in the 'country' state when the home page loads. If you pass that state as a prop down to the CardDetails component, you can loop through this data to find the 'alpha3code' that matches the 3-letter country code for your border countries, and then return the 'name' from that country instead of the 3-letter code.

If you don't want to deal with props and React Router, you could fetch and store the data from 'https://restcountries.eu/rest/v2/all' each time the CardDetails component loads, but this would slow your app down quite a bit.

Hope this helps! Happy Coding!

1

@nikkuv

Posted

@jesse10930 Thank you so much for this :) I'm working on it.

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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