Design comparison
SolutionDesign
Solution retrospective
Hello worldπ€, this is my solution for the challenge Rest countries API with theme switcher
What did you find difficult while building the project?
- The most difficult part for me was the routing part. As I've never experimented with that, I had a lot of trouble building it
Wich areas of your code are you unsure of?
- None, but feedbacks are always welcome if you find something that isn't a good practice
Do you have any questions about best practices?
- None
Community feedback
- @MaeWolffPosted over 1 year ago
Hi Matheus!
I've identified a few things to improve:
- Your custom hook
CallCountriesAPI
should be named with the prefixuse
(souseCountries
for example) to respect the convention rules and allow the linter to check if you are using the hook according to the rules of the react hooks - You can type your states in the following way:
const [state, setState] = useState<YOUR_TYPE_HERE>(defaultValue)
- Avoid using the type
any
, maybe useunknown
or create the real types
Congrats on your post :)
Marked as helpful1 - Your custom hook
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