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

Country api with theme switcher using React & Tailwind CSS

react-router, redux, tailwind-css, typescript, vite
Francis7575•860
@Francis7575
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?

In this project, I utilized React Router DOM to handle multiple routes, including a dynamic route for displaying more information related to country selected. I also used a data.json file to render the project's data on the frontend efficiently. For state management, I implemented React Redux to manage the app's functionality, including setting up a custom hook for handling Dark Mode. Additionally, I integrated Lazy Loading to optimize performance by loading content as the user scrolls down the page.

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

During this challenge, I encountered an issue where LazyLoad was being applied universally, including during searches or when filtering countries by continent, rather than just on the main page. To resolve this, I implemented a boolean state in the parent component that managed the search, filter, and main components. By passing this state as a prop all the components filter and search bar and main component, I was able to conditionally apply LazyLoad only in the main page.

What specific areas of your project would you like help with?

During this challenge, I encountered an issue where LazyLoad was being applied universally, including during searches or when filtering countries by continent, rather than just on the main page. To resolve this, I implemented a boolean state in the parent component that managed the search, filter, and main components. By passing this state as a prop all the components filter and search bar and main component, I was able to conditionally apply LazyLoad only in the main page.

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 Francis7575'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

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