@Brezus
Posted
Awesome work dude i just finished this project too and to be able to click through the links you will need to use react routers Link here is a step by step guide
1 Import { Link } from react-router-dom
2 Wrap your border elements inside the Link eg <Link>Random Border</Link>
3 Add a to attribute on the Link tag/component eg <Link to={/${Random Border}
}>Random Border</Link>
4 Go to your Details file or component I assume you are using useEffect to fetch data of the country the user clicked on.
5 Your useEffect should have a dependency array which might be empty inside that array add the name of the country the user clicked on this way whenever the name changes the useEffect will re run and update the data
I hope this is all clear to you and if not here are three videos which helped me out https://www.youtube.com/watch?v=RUFxmAjbNbg, https://www.youtube.com/watch?v=y_pr4lRoUto, https://www.youtube.com/watch?v=aZGzwEjZrXc&t=12s
Marked as helpful
@jelenkoo10
Posted
@Brezus Thank you so much!! I will check up your project too. I thought about using Links only, but wasn't exactly sure how will that do, since I learned only basics of React Router, like working with Switch and Routes, and Links in App component. Also, for this solution I might need to change my project structure a little bit, since I am fetching data on the homepage and then forwarding it to my CountryDetail component as a prop. I will try it, thanks for the feedback one more time! I will check those videos too.
@Brezus
Posted
@jelenkoo10 your welcome im glad i could help in anyway good luck and happy coding :)