This is a solution to the REST Countries API with color theme switcher challenge on Frontend Mentor.
Users should be able to:
- See all countries from the API on the homepage
- Search for a country using an
input
field - Filter countries by region
- Click on a country to see more detailed information on a separate page
- Click through to the border countries on the detail page
- Toggle the color scheme between light and dark mode
- Solution URL: Front-end Mentor
- Live Site URL: Vercel
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- CSS Grid
- Desktop-first workflow
- React - JS library
- React Query - React library to make HTTP requests
- React Router DOM - React library to make different routes in the application
- React Select - React library to make custom select input
- Framer Motion - Animations library
- Styled Components - For styles
- Font Awesome - Icon library
I learned how to use react query to make HTTP requests (which is much more simple than making requests manually), and used react select for the first time to use a custom select input.
To see how you can add code snippets, see below:
function getAllCountries() {
return useQuery('getAllCountries', async () => {
return await fetch(`https://restcountries.com/v3.1/all`).then(data =>
data.json()
)
})
}
const { data, isLoading } = getAllCountries()
- Frontend Mentor - @emanuelm45
- LinkedIn - Emanuel Marques