Submitted
Rest Country API using React
- HTML
- CSS
- JS
- API
I wanted to jump ahead to an advanced challenge to push myself. I was able to get everything functional and it runs well. I'm probably not using some React best practices though. Below are a few notes on my code. Recommendations to improve are always very appreciated.
-
To style the components in Light and Dark mode, I'm passing the theme value to the components with props and then conditionally giving them different classes based on thatโจ props.theme value. This doesn't feel like the most elegant way to do it.
-
I tried to set up the logic for filtering and search simultaneously, or searching through only the filtered countries. I.e. if you select Africa for a filter and then search "Be" it will only show countries that match both the search and the filter. It seemed like the API did not allow you to call data from it with both of these criteria applied simultaneously. So for now this functionality is not present. Does anyone know if that is possible and I was not calling the API correctly for this? (I suppose I could store the filter data from the API in a state and then apply the search "locally" to that as opposed to doing both directly from the API.)
Thanks so much.