PaulLeCam / react-leaflet

React components for Leaflet maps
https://react-leaflet.js.org
Other
5.13k stars 884 forks source link

Markers classes / icons #15

Closed bleucitron closed 9 years ago

bleucitron commented 9 years ago

Hi there !

I am having a problematic issue concerning the rendering of markers using your lib (Markers and Map are React-Leaflet components). I have about 1100 markers of 4 or 5 different types on a map, and i have coded some filter buttons with React, that recalculate which markers should be displayed or not. Initial rendering is ok (i.e displaying markers when map is empty), but on further renderings, my classes are mixed. For some reason i get my markers with classes that are not correct. I've tried with icons, same thing... My filter logic is correct, so i figured maybe with the component ...? Am i missing something here or is this something that happened already ?

PaulLeCam commented 9 years ago

Hi,

Sure it can be an issue with the library, but hard to tell without a code example. Are you setting a unique key property on each Marker?

bleucitron commented 9 years ago

Nop, i wasn't aware i could do that. I had to switch back to regular Leaflet for delivery reasons (had to get it done :/), but i'm starting a new project, and i'll try just that. What's the actual purpose of key properties ??

PaulLeCam commented 9 years ago

It's used by React to keep track of components identity, see: https://facebook.github.io/react/docs/multiple-components#dynamic-children