Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 1 year ago

Countries API w/ theme switcher - React/SCSS/React-Router/React-Query

react, tanstack-query, react-router, motion
Alfonso Pruneda•190
@915fonzie
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


What are you most proud of, and what would you do differently next time?

It was my first time learning how to use loaders from react router and putting that together with react-query took a lot of effort but I'm very happy that I've managed to make it work and I plan on learning even more to see if there are things I missed to make things more efficient.

What challenges did you encounter, and how did you overcome them?

My first big challenge was figuring out how to use AnimatePresence from framer motion with the react router v6. Since react routers setup is different now using createRouteBrowser (in my case), the known method I had for implementing AnimatePresence was gone and had to figure out a new way. After many hours, I learned about creating an outlet wrapper using AnimatePresence and it finally worked.

After that, the only other big challenge was learning how to implement loaders while also using react-query to fetch my data from the countries API. It felt very challenging since I couldn't find much info through googling, but eventually after reading through the documentations for both, I managed to piece together something that, to me, seems to be working.

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 Alfonso Pruneda'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