I am using Leaflet JS
export const showDataOnMap = (data, casesType ='cases', selectedCountry) =>
data.map(country => (
<Circle
center={[country.countryInfo.lat, country.countryInfo.long]}
fillOpacity={0.4}
pathOptions={country.countryInfo.iso2 === selectedCountry
? casesTypeColors[casesType].highlight /* if selectedCountry then highlight circle! */
: casesTypeColors[casesType].option
}
radius = {
Math.sqrt(country[casesType]) * casesTypeColors[casesType].multiplier / 2
}
>
<Popup popupopen={country.countryInfo.iso2 === selectedCountry ? Popup.openPopup()}>
<div className="info-container">
<div
className='info-flag'
style={{backgroundImage: `url(${country.countryInfo.flag})`}}
/>
<div className='info-name'>{country.country}</div>
<div className='info-cases'>Cases: {numeral(country.cases).format("0,0")}</div>
<div className='info-recovered'>Recovered: {numeral(country.recovered).format("0,0")}</div>
<div className='info-deaths'>Deaths: {numeral(country.deaths).format("0,0")}</div>
</div>
</Popup>
</Circle>
When i select an option from my dropdown menu, aka "country.countryInfo.iso2 === selectedCountry", I would like for my that is within my component to appear immediately. However, i am not exactly sure how to use the .openPopup method into a component. I basically just want the pop up to appear the moment the condition "country.countryInfo.iso2 === selectedCountry" is true.
I am using Leaflet JS