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

REST Countries API with Color Theme Switcher

accessibility, react, react-router, tailwind-css, fetch
Abdul Rahman•60
@Abdul-Rahman-E
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?

What I'm Most Proud Of:

  1. Custom Hook Implementation:

    • I developed a custom useFetch hook that made data fetching more efficient and reusable across various components. This significantly improved the code organization and maintainability.
  2. Accessibility Enhancements:

    • Implementing ARIA attributes to ensure the application is accessible to users with disabilities was a key accomplishment. Making the search bar and filter box accessible was particularly challenging but ultimately rewarding.
  3. Responsive Design:

    • Utilizing Tailwind CSS along with Flexbox and CSS Grid allowed me to create a highly responsive and visually appealing design. The application looks and performs well on both desktop and mobile devices.
  4. Dark Mode Feature:

    • Adding a theme switcher for light and dark modes not only improved the user experience but also showcased my ability to handle state management effectively with React Context.
  5. Skeleton Element and Page Design:

    • Creating the skeleton element and page design was a notable achievement. The skeleton elements provided a placeholder UI while data was being fetched, enhancing the user experience by giving visual feedback. The implementation involved carefully designing and styling the skeleton elements to mimic the final content structure.
  6. Shimmer Effect Integration:

    • Integrating the shimmer effect seamlessly with the skeleton elements was another accomplishment. The shimmer effect added a subtle animation to the skeleton elements, making them visually engaging while maintaining a clean and professional appearance. Implementing this effect involved precise styling and animation techniques to ensure smooth rendering and performance.

What I Would Do Differently Next Time:

  1. Performance Optimization:

    • I would focus more on optimizing the performance of the application. This could involve techniques such as code-splitting, lazy loading components, and further minimizing the bundle size.
  2. Advanced State Management:

    • Although the project didn’t require complex state management, exploring tools like Redux or Zustand could provide more robust solutions for larger applications.
  3. Refinement of Shimmer Effect Performance:

    • While the shimmer effect added visual appeal to the skeleton elements, I would focus on refining its performance to ensure smooth rendering across different devices and browsers. This could involve optimizing CSS animations, leveraging hardware acceleration, and testing performance on a wider range of devices to identify and address potential bottlenecks.
What challenges did you encounter, and how did you overcome them?
  1. Data Fetching Complexity:

    • Fetching data from the REST Countries API presented challenges due to its large dataset and nested structure. To overcome this, I carefully studied the API documentation and implemented efficient data fetching strategies using asynchronous JavaScript (async/await) along with error handling techniques.
  2. Responsive Design Issues:

    • Ensuring the application's responsiveness across various screen sizes and devices was a challenge. To address this, I utilized CSS Grid, Flexbox, and Tailwind CSS utility classes to create a flexible and adaptive layout that adjusts seamlessly to different viewport sizes.
  3. State Management Complexity:

    • Managing application state, especially when implementing features like search functionality and theme toggling, required careful consideration. To tackle this, I leveraged React hooks like useState and useContext along with React Context to manage global state and provide a seamless user experience.
  4. Accessibility Implementation:

    • Implementing accessibility features such as keyboard navigation and screen reader compatibility posed challenges. I addressed this by conducting thorough research on accessibility best practices and incorporating ARIA attributes into components like the search bar and filter box, ensuring a more inclusive user experience.
  5. Deployment and Hosting:

    • Deploying the application to a hosting platform and ensuring smooth deployment workflow presented challenges. To overcome this, I explored different hosting options, ultimately deploying the project to platforms like Netlify, which provided seamless integration with GitHub for continuous deployment.
What specific areas of your project would you like help with?

In my project, I'm currently focusing on optimizing performance and enhancing accessibility. Specifically, I'm seeking assistance with the following areas:

  1. Performance Optimization: I'm looking for guidance on minimizing bundle size and improving loading times to enhance the overall performance of the application.

  2. Accessibility Enhancement: I aim to further refine accessibility features to ensure inclusivity for all users. Any insights or best practices in this area would be greatly appreciated.

Any assistance or advice on these specific aspects of the project would be incredibly valuable.

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 Abdul Rahman'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

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit 1st-party linked stylesheets, and styles within <style> tags.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.