Skip to content

daniel-web-developer/flags-api

Repository files navigation

Frontend Mentor - REST Countries API with color theme switcher solution

This is a solution to the REST Countries API with color theme switcher challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

The challenge

Users should be able to:

  • See all countries from the API on the homepage
  • Search for a country using an input field
  • Filter countries by region
  • Click on a country to see more detailed information on a separate page
  • Click through to the border countries on the detail page
  • Toggle the color scheme between light and dark mode (optional)

Screenshot

image

Links

My process

Built with

  • Nextjs
  • JavaScript
  • JSX
  • Sass
  • JavaScript
  • Flexbox
  • Desktop-first workflow

What I learned

I learned A LOT by coding this project. At first, I thought that using an API was only about fetching it and displaying the contents, as easily as displaying objects in Django, for instance. I was incredibly wrong.

Unlike my other API solutions posted in Frontend Mentor (as is. I may fix them later), this one doesn't have any hydration problems whatsoever. I learned to use the React hook useEffect in order to properly fetch and render the objects with no hydration problems.

I also used, for the first time ever (on an actual project), the .filter() function. Implementing the search function was actually my biggest problem.

This was my first time implementing a theme changer (to toggle light/dark mode). Please check useful resources to learn how I did it.

Useful resources

Author

Acknowledgments

I'd like to point out that my code was loosely inspired on Ekaterine Mitagvaria's solution (live site, Frontend Mentor solution and code).