The simplest and fully describe solutions.
The infoWindow itself should only contain a placeholder div with a unique id:
<InfoWindow
marker={this.state.activeMarker}
visible={this.state.showingInfoWindow}
onOpen={e => {
this.onInfoWindowOpen(this.props, e);
}}
>
<div id="xyz" />
</InfoWindow>
And inside the Mapcontainer, you define an onInfoWindowOpen callback, that inserts a single component/container with the onClick event and render it to a placeholder div:
onInfoWindowOpen = () => {
const button = (<button
onClick={
() => {
this.viewClinic(this.state.selectedPlace.slug)
}
}>
View Details
</button>);
ReactDOM.render(React.Children.only(button),document.getElementById("xyz"));
}
Here is a working example:
One more complete example MAP, Marker and InfoWindow:
If you have any questions so please comment.