Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 2 years ago

REST countries | Redux | Emotion | react-router | accessibility

accessibility, axios, emotion, react, redux-toolkit
Pavel B.•270
@Jagholin
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


This was my first time using Redux for state management(which was clearly an overkill for this small project) and I learned a lot about it. I also learned how to use Playwright for E2E testing. I was already familiar with emotion since I used it in other projects as part of Material UI.

In this project I also tried to implement a combobox control element from scratch following the WAI/ARIA guidelines. Not sure if I did it right, and I certainly will not try to reinvent the wheel next time, but it was a good learning experience.

Another thing I tried to do in this project is to follow Cube CSS methodology for styling. I had some problems figuring out how to do it with Emotion, and in the end I'm not sure if I did a good job with it, hence I'm not adding it to the list of technologies used for this project. I still tried to follow the general idea of Cube CSS to separate layout and styling.

Continued development

As it is right now, the app is completely functional, but there are some things that can be improved in the future. I use Playwright for E2E testing, but I dont have many tests yet. I also use Redux store to save Promises for fetching data, which is not what you supposed to do (and yes I know that it complains about it in the console). But it works and for this particular project it is not a big deal. I looked into using RTK Query for this, but it would be an even bigger overkill for this project and I decided to just leave it as is for now.

Also I think I will redo the styling for this project in the future, to have much more clear and consistent separation of concerns. I'm still trying to figure out how to best do it with tools like Emotion.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Emmanuel Daniel•1,170
    @coderdannie
    Posted about 2 years ago

    Hi. Congrats on the completion of this project. An extra features you can add is to store the themes state using browser localstorage so that your site can maintain the theme state even if the page was reload. Right now if I switch to dark mode and reload the web page its switching back to the default theme. Using browser storage to store the theme and accessing the themes based on user preference will prevent this from happening. https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

    Marked as helpful

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 all CSS, SCSS and Less files in your repository.

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.

How does the JavaScript validation report work?

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

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

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

Log in with GitHub