
Rest Countries API using TS | React | Redux
Design comparison
Solution retrospective
This project was really interesting to build. It tested my knowledge in working with technologies including TypeScript, React, Redux.
My questions: How did you ensure persistence of the data received from the API fetch when the application loads and ensure that you are able to use that same data in the store through out the application even when the user selects a country flag card and reloads the browser?
Also, if you notice any weird behavior and knows a better way I can handle that please let me know?
I am available for collaboration.
Community feedback
- @Bjorn86Posted almost 2 years ago
According to your question, I implemented it this way: a request to the API for all cards is made when the App is mounted with
useEffect
hook. The cards are recorded in the state and also sent to the component for detailed card display. And in this component a specific card is already determined (also when mounting the component usinguseEffect
hook), in my case I usedcca3
code to search for the card in the array of all cards, it is also used for the url of the child route. This way you can not only save the page when you restart the browser, but you can also access it via a direct link. You can see my implementation and code here.P.S. Forgive my poor English )
Marked as helpful0 - @syntaCorpPosted almost 2 years ago
Rest Countries API server gets overwhelmed and may be down sometimes. Please feel free to try the application again.
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