@Daniil034
Posted
Hey! Good job with this API) I haven't yet done any project with API and I have no idea how to deal with it and with async functions at all. Why did you name your style files with 'module'? What convention is it? And... Are you sure that it is okay to show everyone your private GoogleMapsAPI key? Maybe you should've hidden it somehow? Just a suggestion)
Marked as helpful
@DonUggioni
Posted
@Daniil034 Hey there,
Yeah I will have to hide that API key, just haven't done it yet. It is restricted to maps only though, but at the time, I didn't really know or was aware of the importance of hiding it.
For the API it is quite straight forward. Works the same as if you were using vanilla JS, just use the fetch API and pass into it the IP address coming from the input, then just use the info you get from the API response. In this case I used ipapi.co, it's free and the info you get is pretty good!
Regarding the style.module files, if you do that, and then import the style into your js file, they become scoped and react will create a unique id for each class name, so that means you can use the same class names in different files and you won't have a naming conflict. That doesn't happen with global files, you have to give different names to all your classes.