Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 2 years ago

REST API Country Viewer with Dark Mode, Made With Next.js

next, react, tailwind-css
Daniel Aadland•100
@GreenCitrus6
A solution to the REST Countries API with color theme switcher challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


One thing I wasn't able to get working was making the bordering countries on the Country Details page render with their common name instead of their 3 letter country code. For this to work without the page asking the API for every country at once, I imagine the page would need to make another API request after pulling information for the main country, but I couldn't manage to get it to work.

Is the way I handled adding a dark mode toggle the best way? I wrapped the Header component and the contents of the page in a container and used a boolean state to handle if dark mode is toggled on or not.

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Daniel Aadland's solution.

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner
  • Use cases

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License