Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 3 years ago

reactjs, redux, javascript

Ren Ras•420
@renras
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


I need feedback on how I code and my folders structure and if there are faster ways to load my api

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Alex•2,010
    @AlexKMarshall
    Posted over 3 years ago

    Hey there. This looks very good on desktop. The semantics are good, and the grid is nice and responsive on the main page.

    Looks like you might've missed making the individual country pages responsive. They overflow at around 900px screen width and under.

    I won't comment on the Redux code as it's definitely not my area of expertise.

    For my taste, there are too many nested folders. This is very much a personal preference, but when you're nesting component folders 3 or 4 levels deep that feels like overkill.

    You don't have to stick to a single component per file. For example you have a <Country/> component (that I would actually call Countries, as it's a list) and then a <SingleCountry/> component in another subfolder. But SingleCountry is only used as a child of Country. I would just define that in the same file.

    Personally I break my components out into reusable things like <Box/> <Stack/> <Grid/> <IconButton/> etc. These are usually just presentational. They can be stateful, but don't usually have business logic. Then I have a features folder for things that aren't re-usable (and are generally built out of my reusable components). It's a bit like Atomic Design (https://bradfrost.com/blog/post/atomic-web-design/) but with fewer levels.

    But that stuff is all completely about personal taste. And it doesn't really matter. I just don't like a deep nested folder structure as I find it hard to find things. This is another guide that's fairly close to the way I do things https://kyleshevlin.com/how-i-structure-my-react-projects

    Marked as helpful
  • Ilie Bogdan•190
    @nosthrillz
    Posted over 3 years ago

    Addressing what you were asking in terms of how to make it faster: you can try Next.js. That way, you wouldn't do any api call at run time, only at build time. And users loading your site would load data as if it was already there in the html files.

    As far as the project goes, there were a couple of requirements you missed:

    • heading font is too big. The designs have a smaller font
    • population number is not comma-separated (in the design it is)
    • individual cards with longer titles will overflow (see "United kingdom of great britain and northern ireland" at a smaller-width screen)
    • the dropdown list is too spaced from its parent (at least according to the design). the space seems to be almost double that of the design-imposed one)
    • in between 650 and 950 px widths, the cards are displayed as two columns on the two sides, which seems a bit odd. Suggest centering
    • country details -> the border countries are not clickable
    • and yes, what the previous person mentioned - the mobile layout:
      • heading doesn't scale
      • filter by region does not switch to column layout or wrap
      • the details page is definitely not mobile friendly. This takes a lot of time and finesse and shouldn't be skipped
    Marked as helpful
  • Ren Ras•420
    @renras
    Posted over 3 years ago

    Yeah I was rushing and missed out on a lot and I've been lazy to make my projects responsive. Thank you I'll know what to update next time!

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.

Frontend Mentor for Teams

Frontend Mentor for Teams helps companies and schools onboard and train developers through project-based learning. Our industry-standard projects give developers hands-on experience tackling real coding problems, helping them master their craft.

If you work in a company or are a student in a coding school, feel free to share Frontend Mentor for Teams with your manager or instructor, as they may use it to help with your coding education.

Learn more

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

Oops! 😬

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

Log in with GitHub