Submitted about 2 years ago
API Countries - using React, HTML, Sass, Axios
@kefer16
Design comparison
SolutionDesign
Solution retrospective
It's my first react application, any comment is welcome
Happy coding! π
Community feedback
- @fazzaamiarsoPosted about 2 years ago
Hi Kevin, Nice work!
I have a quick fetch error handling tip for you. Here is the improvement.
const getCountries = async (codeCountry) => { try{ const url = `${process.env.REACT_APP_URL_API}/alpha/${codeCountry}`; const response = await get(url); if(!response.ok) throw new Error("Something went wrong!"); const data = response.data; return data[0]; } catch(err){ console.log(err.message); } };
I hope it helps! Cheers!
0
Please log in to post a comment
Log in with GitHubJoin 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