I’m trying to use data that has an image url as part of an object. Normally, you would assign import the image and assign it to a variable. However, I am unable to do that as I’m planning on using an API call to get this image urls. Currently I’m using mock data and have been unable to successfully render the image. I want to add an image to the <InfoWindow>
component.
I’ve tried:
<img src={selectedSite.image} alt={`alien ${selectedSite.eventType}`} />
<img src={require(`${selectedSite.image}`} alt={`alien ${selectedSite.eventType}`} />
Mock Data
export const mockSightings = [
{
name: '',
lat: '47.7511',
lng: '-120.7401',
description: 'BIG BLUE BALL IN SKY OMG',
eventType: 'sighting',
image: 'https://cdn.mos.cms.futurecdn.net/QkuLCPzH7GUVS9MthdWM9M.jpg',
},
{
name: 'Billy Bob',
lat: '43.8041',
lng: '-120.5542',
description: 'BIG RED BALL IN SKY OMG',
eventType: 'sighting',
image: 'https://ewscripps.brightspotcdn.com/dims4/default/3402aa2/2147483647/strip/true/crop/1000x563+0+0/resize/1280x720!/quality/90/?url=http%3A%2F%2Fewscripps-brightspot.s3.amazonaws.com%2F5a%2F57%2F58a3662b422a8fb6464451f244eb%2Flarge-fireball-seen-across-fl-sky-mari-g.png',
},
{
name: 'Stephanie Jo',
lat: '44.0682',
lng: '-114.7420',
description: 'rotating lights',
eventType: 'sighting',
image: 'https://i.dailymail.co.uk/i/pix/2016/10/04/01/391305FA00000578-3820675-image-a-23_1475542666609.jpg',
}
]
Component
import React, { useState } from "react";
import {
GoogleMap,
useJsApiLoader,
Marker,
InfoWindow,
} from "@react-google-maps/api";
import { mockSightings } from "../../mockdata";
const containerStyle = {
width: "1500px",
height: "800px",
};
const center = {
lat: 39.8283,
lng: -98.5795,
};
const SightingsMap = () => {
const [selectedCenter, setSelectedCenter] = useState(null);
const [selectedSite, setSelectedSite] = useState(null);
const { isLoaded } = useJsApiLoader({
id: "google-map-script",
googleMapsApiKey: `${process.env.REACT_APP_API_KEY}`,
});
const generateMarkers = () => {
return mockSightings.map((sighting) => {
const position = {
lat: parseInt(sighting.lat),
lng: parseInt(sighting.lng),
};
return (
<Marker
position={position}
onMouseDown={() => {
setSelectedSite(sighting);
}}
onMouseUp={() => {
setSelectedCenter(position);
}}
/>
);
});
};
return isLoaded ? (
<GoogleMap mapContainerStyle={containerStyle} center={center} zoom={5}>
{generateMarkers()}
{selectedCenter && (
<InfoWindow
onCloseClick={() => {
setSelectedCenter(null);
}}
position={selectedCenter}
>
<div>
<div>
<p>{selectedSite.name ? selectedSite.name : "anonymous"}</p>
<p>{selectedSite.description}</p>
<p>{selectedSite.eventType}</p>
</div>
<img src={selectedSite.image} alt={`alien ${selectedSite.eventType}`} />
</div>
</InfoWindow>
)}
</GoogleMap>
) : (
<></>
);
};
export default SightingsMap;
http://vardenafilz.com dosage levitra
https://kamagraday.com/ kamagar oral jelly
provigil a stimulant – provigil dosage provigil 200mg
accutane 20mg – isotreti.com accutane generic price
https://wardenafil.com vardenafil 20mg india
amoxicillin for uti – amoxicillin amoxicilin brand name
http://levitradd.com/ generic levitra mexico
vardenafil coupon – levitra pills buy vardenafil online order
http://prescriptionhim.com viagra without prescription
https://himscanada.com/ tadalafil generic
http://levitradd.com/ how long does 10mg levitra last
ivermectin 12 – stromectol tablets for humans for sale ivermectin 6
generic cialis online europe – cialis 5 discount cialis
ivermectin 3mg tablet – ivermectin 50ml how much does ivermectin cost
http://levitrair.com levitra canadian pharmacy
accutane 5 mg online – accutpharm.com buy accutane online cheap canada
lyrica 550 mg – lyrica 300 mg price uk canadian pharmacy coupon code
https://prescriptionhim.com/ canada viagra no prescription
amoxicillin brand name – generic amoxicillin at walmart buy amoxicilina 500 mg
https://himshairloss.com/ procar propecia dose
viagra 500mg tablet price in india – sildenafil 100mg for sale viagra sildenafil 50mg
mature dating
is blake shelton dating gwen stefani
http://goldkamagra.com kamagra oral jelly
buy cialis india pharmacy – canadian cialis no prescription best cialis online canadian pharmacy
where can i buy stromectol – stromectol buy stromectol pharmacy
prednisone 20 mg buy online – prednisone 500 mg prednisone 5mg tablets
http://stromectolhumans.com/ stromectol
https://viagraxyu.com how to buy viagra online
modafinil for sale – provigil online buy provigil
http://iwermectin.com/ how to buy ivermectin
what is azithromycin – order zithromax 100mg order azithromycin 250mg
lasix generic name – furosemide online lasix dosage
clomiphene tablets – clomid generic buy clomid 100mg
female viagra in india online purchase – generic viagra mexico pharmacy buy sildenafil paypal
https://ivermectineffects.com/ dosage ivermectin for humans
https://ivermectinovercounter.com/ ivermectin for humans over the counter skin
http://ivermectineffects.com ivermectin for humans dosage
best buy cialis – cialipll.com tadalafil canadian pharmacy online
https://ivermectinus.com/ ivermectin over the counter
levitra vs viagra http://levitrair.com levitra 20 mg film coated tablets
how to sue a health insurance company in small claims court republican healthcare plan
ivermectin tablets https://ivermectinhome.com
buy ivermectin http://stromectolus.com ivermectin
http://albuterolotc.com/ buy asthma inhalers without an rx
tadalafil 20mg price – Cialis samples cialis buy india
heat stroke symptoms in elderly dr for doctor
stromectol https://ivermectinhome.com
ivermectin for humans for sale https://ivermcov.com/# ivermectin
javascript-help.li recommended worldwide pharmacy canada https://pharmvolk.com buy medication online
recall on blood pressure medicine http://ventolinhfaer.com/ ventolin tablet side effects
who is a physician specialist carolina healthcare systems
stromectol https://ivermectinhome.com
javascript-help.li vs ivermectin http://ivermectini.com can humans take horse ivermectin
health insurance requirements http://albuterolinh.com buy asthma inhalers without an rx
javascript-help.li vs soolantra krem http://ivermectiny.com ivermectin for humans where to buy locally near me
healthcare market place ivermectin tablets http://iveramectin.com stromectol
medical school website http://ivermectinsl.com ivermectin for humans walmart
arthritis + interlukin 10 + dog http://vidalistahim.com vidalista
united care insurance https://dapoxetineus.com/ priligy dapoxetine
how do doctors diagnose asthma https://dapoxetineus.com/ dapoxetine online
javascript-help.li with ivermectin human dosage https://ivermectiny.com ivermectin over the counter
buying viagra without prescription https://viagrob.com viagra amazon
javascript-help.li reviewed stromectol for humans https://ivermectinhum.com stromectol 3mg tablets
ivermektin eladГі where to buy ivermectin in phoenix https://stromectl.com stromectol
zithromax antibiotic for sinus infection https://azithrozpack.com azithromycin 500mg tablets for chlamydia
ivermectin for humans for sale – generic stromectol for humans stromectol tab
http://ycialisy.com – cialis cheap online
stromektoli https://ivermectin1.com/ stromectol
https://stromectolo.com – ivermectin tablette
https://ivrmectin.com – can you buy ivermectin over the counter
http://gabenhim.com – gabapentin erowid
why dopresenters use presentation aids? http://withoutscript.com – the cost of viagra
viagra in usa online – buy cheap viagra online generic tadalafil uk
http://stromectolforte.com/ topical ivermectin for humans over the counter
allegra – http://allergyd.com
prednisone 5mg cost – order prednisone without prescription fast shipping prednisone 40mg pills
blood pressure monitor panasonic http://ivermectinsl.com – ivermectin germany
dr pierre kory ivermectin https://stromectolforte.com/# ivermectin india ivermectin
biaya pil ivermectin https://ivermecton.com/ ivermectin for humans for sale cvs
viagra super https://www.viagwdp.com/ viagra medication online viagra use
stromectol chung http://ivermectinhum.com/ ivermectin tabletleri uk
http://ivermecton.com – 3mg ivermactin
ed meds https://www.viagwdp.com/# order sildenafil from india cheap generic viagra 50mg
prednisone 5 tablets – prednisone 60mg no prescription corticosteroids prednisone
http://lasixotc.com younger men have erectile dysfunction
ivermectin without doctor prescription http://stromectol.today obsergo
ampicillin 500mg over the counter – buy flagyl 200mg online buy plaquenil 400mg online cheap
viagra 50mg tablet – liquid cialis order tadalafil 10mg generic
generique sildenafil – sildenafil 100mg pour homme cialis 10mg en france
ivermectin 3mg tablets price – modafinil ca ivermectin cream 1
lyrica buy online – albuterol 4mg over the counter purchase zithromax
purchase cenforce – order acyclovir 400mg without prescription purchase acyclovir generic
cialis without a prescription cheap generic cialis for sale
cheap cialis pills for sale tadalafil price walmart
cheap cialis – stromectole online ivermectin 3mg for people
buy cialis pills canada generic tadalafil
cheap cialis pills for sale buy generic cialis online with mastercard
tadalafil cialis cheap generic cialis for sale
https://cialisbusd.com/ where to order tadalafil tablets
tadalafil price walmart cialis without a prescription
https://ivermectinuni.com/ stromectol 12 mg
ivermectin uk 3mg 6mg 12mg stromectol 3 mg tablets
http://ivermectinuni.com/ buy stromectol 12 mg
stromectol how much it cost