Design comparison
Solution retrospective
I learned how to use the useParams hook to access a path from the url and display the page based on that path i accessed. The useParams hook is used with the react-router-dom.
To see how you can add code snippets, see below:
const countryName = useParams()
const res = Data.filter(item => item.name === countryName.countryName)
<CountryPage
image = {image}
name = {name}
nativeName = {nativeName}
population = {population}
region = {region}
subRegion = {subRegion}
capital = {capital}
topLevelDomain = {topLevelDomain}
currencies = {currencies}
languages = {languages}
borderCountries = {res[0].hasOwnProperty('borders') ? borderCountries : borderEmpty}
/>
Community feedback
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