
Day 20 of #100DaysOfCode — Building a Tour App (Part 2)
Today marks Day 20 of my #100DaysOfCode challenge, and I finally started the actual coding phase of my tour application after setting up the project structure. In this part, I focused on: ✔ Fetching country data ✔ Using React Query for caching ✔ Fetching images from the Unsplash API ✔ Managing state with Zustand ✔ Displaying the final results in the UI Let’s walk through everything I built today. 🌍 Fetching Countries with Axios The first step was building a simple API utility to fetch countries from the API. import axios from ' axios ' export const fetchCountries = async () => { const { data } = await axios . get ( ' https://restcountries.com/v3.1/all?fields=name ' ) return data } This function sends a GET request to the REST Countries API and extracts only the name field. axios.get() → fetches all countries fields=name → reduces payload size Returns the cleaned data for consuming components and hooks 🔄 Using React Query ( useQuery ) to Cache Countries To handle caching and background
Continue reading on Dev.to React
Opens in a new tab


