@lipe11
Posted
Hi, nice solution!. I'm currently working on this project myself.
I think your react code is very clean, if you're just starting, you're definitely on the right track.. And adding the map was a nice touch too!
Just a couple of small suggestions:
-
consider putting your fetch functions into a module, and import them from your components.
-
instead of using the regex for the comma separated list, you could use
array.join(', ')
Marked as helpful
@lipe11
Posted
sorry, I think the regex wasn't for the comma separated list, but for the population... in that case number.toLocaleString()
does the trick.
Marked as helpful
@redshift14
Posted
@lipe11 Thanks a lot for your feedback. I think putting fetch functions in a separate module is a good idea, and you are right using toLocaleString() is better than using regex I will modify it too.