REST Countries API with React, React Router, CSS Modules
Design comparison
Solution retrospective
I found this one exciting! This is my first advanced project. I struggled with styling the Filter by region select input so I have left it for now. Here are some additional features I added:
- A back to top button when the user scrolls a bit further below
- Show more button so not all the countries are displayed at one
- Persistent light/dark mode
- Fully responsive on all screen sizes
I am still a beginner in React and jumped a lot of challenges to this one so any feedback on the code and practices are welcome.
Also, can someone explain to me when to use useHistory and when to use <Link /> in routing?
Thank you!
Community feedback
- @renrasPosted over 2 years ago
Link
doesn't trigger a full page refresh compared to using ana tag
which would reset the application state. Normally, you'd always want to useLink
for navigating throughout different pages in your application. I believeuseHistory
is used for programmatically redirecting users to a different page where you can't useLink
. Like inside a code block:const history = useHistory(); const register = async () => { await register(user).then((username) => { history.push(`/profile/${userName}`); }) }
Marked as helpful1@GloriaSekyerePosted over 2 years ago@renras this is very helpful. I couldn't find a more concise explanation anywhere. Thank you.
1
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