Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 4 months ago

Rest Countries Api using Next, Tailwind and TypeScript

fetch, next, tailwind-css, typescript, react-aria
P
Kamran Kiani•2,780
@kaamiik
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?

I'm most proud of implementing advanced Next.js 15 features like unstable_cache for API optimization and useOptimistic for seamless user interactions.

I handled complex state synchronization between URL parameters, search filters, and optimistic updates while maintaining accessibility with React Aria Components

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

The biggest challenge was managing theme persistence across server-side rendering and client-side hydration without causing mismatches. I solved this by implementing cookie-based theme detection on the server side and proper client-side synchronization.

What specific areas of your project would you like help with? Areas I'd like help with
  1. Performance Optimization

    • Best practices for reducing unnecessary re-renders
  2. State Management

    • Better patterns for managing complex state
  3. Accessibility

    • Ensuring the application meets WCAG standards
    • Improving keyboard navigation and screen reader support
Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Darkstar•1,440
    @DarkstarXDD
    Posted 1 day ago

    Looks nice.

    Any reason why you are setting up the font files manually? If there is a specific reason for that then it's fine, but otherwise Next.js has a built in workflow for that. You can simply import any google font from next/font/google inside your layout.tsx file (or any other file you like) and then use that. When your app is built, Next.js will automatically download that font file and self host it. So you don't have to include the font assets and then reference them with @font-face in your .css file. Docs

    Again, if you have a reason to not use it then it's totally fine, but I just shared in case you were not aware of that feature.

    Marked as helpful
  • Wendy•2,170
    @wendyhamel
    Posted 7 days ago

    Hi there!

    • Great match to the design!
    • Great research on the error handling and keeping track of your personal challenges.
    • Light and dark mode switch out smoothly, without upsetting your eyes

    I could not test it thoroughly because the API was not working as it should. But the layout looks good on different screen sizes.

    Happy coding!

    Marked as helpful
  • Adam Crowley•190
    @adam-crowley
    Posted 4 months ago

    Style

    Responsive layout/style looks good.

    On the CountryDetail component, the flag image aspect-ratio is distorted. This can be fixed by setting height of the img tag to auto and removing the max-height property.

    Currency the flags rendered are PNG links. The SVG links are visually sharper. The json file has svg and png links for each countries flags property.

    Animation elements for light/dark mode: Some elements don't have an color animation transition. The animation would look smoother if all the elements transition together.

    Function

    The persistant light/dark mode on reload is cool.

    The filter/dropdown functionality, in combination with country search is really good usability-wise.

    State management: I recommend Zustand for global state management. It's easy to get to grips with and it saves complex prop drilling.

    Accessibility

    Accessibility looks good, but you can run it through this tester if you want to get it perfect. https://wave.webaim.org/

    Great job!

    Marked as helpful
  • P
    Romeocodes•90
    @Romeo899
    Posted 1 day ago

    web app looks awesome. Nice!👍

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

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

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