IP ADDRESS TRACKER USING REACT JS, GEO IPFY AND LEAFLET
Design comparison
Solution retrospective
Was not able to add the custom marker icon, tried implementing the FlyTo for when the ip changes the map centers the marker icon.......i need help😂😂 any advice??
I think i'll try out the google maps instead of leaflet
Community feedback
- @dragi-nsPosted almost 2 years ago
Hi, looks good! I also just finished this challenge.
You can add a custom marker with the
Icon
class fromleaflet
package and then you pass that instance to theicon
prop on theMarker
component fromreact-leaflet
package.As for why doesn't map change when the position is updated take a look at this stackoverflow answer.
MapContainer
props are immutable: changing them after they have been set a first time will have no effect on the Map instance or its container. So that means you need to create another component as a child ofMapContainer
that will update map withmap.setView
.Hope this helps!
Marked as helpful0@newton-wPosted almost 2 years ago@dragi-ns thanks for the tips.
Everything is working as it should now
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