e.getMarkers() - how can i get markers with props?
See original GitHub issueI have this code:
<MarkerClusterer
averageCenter
enableRetinaIcons
gridSize={60}
onClick={onClickCluster}
zoomOnClick={false}
>
{[
{ x: 45, y: 40, id: 0 },
{ x: 46, y: 40, id: 1 },
{ x: 45, y: 41, id: 2 },
{ x: 45, y: 42, id: 3 },
{ x: 45.05, y: 40, id: 4 },
]
.map((el, i) => (
<Marker
position={{ lat: el.x, lng: el.y }}
onClick={e => onClickMarker(e, el)}
id={i}
ref={refMarkers}
/>
))}
</MarkerClusterer>
If i use e.getMarkers- i get array of objects with markers but they don’t have props. How can i get array of markers with props? I want to know ids from props of marker which contents cluster (when user click on cluster).
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
react-google-maps pass props on marker click - Stack Overflow
Pass props to parent component in React.js ... Usually you want to map the locations and each location should have some kind of...
Read more >react-native-maps.MapView.Marker JavaScript and Node.js ...
How to use. Marker. function ... const Map = props => <MapView style={styles.map} width={props.width} ... render() { let marker = null; if (this.state....
Read more >React Google Maps Api Style Guide
The simplest way to get a functional map is: ⚠️ Make sure you cache the props passed to GoogleMap to avoid re-renders that...
Read more >photo-sphere-viewer - UNPKG
photo-sphere-viewer/dist/plugins/markers.js.map. Version: ... stopPropagation();\n }\n\n // the marker could have been deleted in an event handler\n if ...
Read more >tomchentw/react-google-maps - Gitter
So to make it work with react, the script tag is dynamically added and asynced so react knows when it finishes loading it....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You should assign an id to a marker instance, by passing in an object to the options prop. These properties will be available through the marker instances when using getMarkers(). Note that while you can pass any key with any value you like, i would advise against doing this.
@DonnyVerduijn Thanks a lot!. This options also work in MarkerWithLabel.