Closed rostgoat closed 4 years ago
Cannot for the life of me get this event of to fire on the child Marker anyone know why?
Marker
I have tried using onClick, using bind and onChildClick but nothing works
onClick
bind
onChildClick
onSelectMarker = marker => e => { e.preventDefault(); console.log("clicked"); }; render() { const data = this.props.searchedResponse; const Markers = data ? data.data.records.map(marker => { return ( <Marker key={marker.recordid} lat={marker.fields.geom.coordinates[1]} lng={marker.fields.geom.coordinates[0]} onChildClick={() => this.onSelectMarker(marker)} /> ); }) : null; return ( <div className="map"> <GoogleMapReact center={this.state.center} zoom={this.state.zoom} bootstrapURLKeys={{ key: process.env.REACT_APP_GOOGLE_KEY }} > {Markers} </GoogleMapReact> </div> ); } }
Cannot for the life of me get this event of to fire on the child
Marker
anyone know why?I have tried using
onClick
, usingbind
andonChildClick
but nothing works