I am currently building a google map api using react-google-maps and I would like to create multiple markers to display info of cities around the world on the info window. But since they are all from the html object. Whenever I clicked on one marker, all info windows will be opened. If there a way to fix this? Sample code:
<GoogleMap
defaultZoom={3}
defaultCenter={{ lat: 40.452906, lng: 190.818206 }}
>
<Marker id = "mark1"
options={{icon: Mark1}}
position={{ lat: 34.4076645, lng: 108.742099 }}
onClick={props.onToggleOpen}
>
{props.isOpen && <InfoWindow id = "info1"
onCloseClick={props.onToggleOpen}
>
<div> content1 </div>
</InfoWindow>}
</Marker>
<Marker
options={{icon: Mark2}}
position={{ lat: 35.6958783, lng: 139.6869534 }}
onClick={props.onToggleOpen}
>
{props.isOpen && <InfoWindow
onCloseClick={props.onToggleOpen}
>
<div> content2 </div>
</InfoWindow>}
</Marker>
</GoogleMap>