Skip to content
  • Learning paths
  • Challenges
  • Solutions
  • Articles
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 4 years ago

REST Countries API / Next.js and Tailwind CSS

Alan•70
@alrightalan
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


Hello!

This was my first time using Next.js and also my first time working with React on a proper project - took me quite some time but I've learned a ton doing this one. Doing projects really is the best way to learn.

I initially watched some stuff on Youtube for Next.js but then I quickly jumped straight into it. I also looked at other people's code a lot and I mean a lot but this helped me immensely I think.

First time passing props to components was a huge ohhhh wow for me. Also, dynamic routing and using the <Link> tag from next/link in Next.js and the way it handles additional pages is very intuitive and easy to use once you get the hang of it. I have also looked into SSR with getServerSideProps() and I wanted to implement this because my thinking was that the user should have a fresh site on each request because even though the api data is pretty static and doesn't really change I still wanted to keep it updated with each request (population numbers might change etc.).

I've used Tailwind CSS for the styling, which is a breeze to use and tons of good fun!

Things I would like to improve are:

  • In localhost the theme toggler is working just fine and it switches between light/dark and also stores the current theme in localStorage but after deployment to Vercel the switch is not working. Maybe somebody has some insights?

  • I would like to implement a proper loading spinner as well.

  • FIXED Another thing would be to display the current selected region in the region filter instead of it saying "Filter by Region" all the time.

  • Another one was to display border countries by their full name instead of the country code.

That was fun!

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 Alan'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
Frontend Mentor logo

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

Frontend Mentor

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

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

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub