@jamiechong wrote:
I’m trying to add a
loaded
class toIonImg
when the image loads. According to docs I should be able to listen to aionDidLoad
event. But it doesn’t seem to trigger.This is the simple component I’ve created:
const LazyImage = ({src}) => { const [ loaded, setLoaded ] = useState(); return <IonImg src={src} onImgDidLoad={() => setLoaded('loaded')} className={loaded} /> }
Note that I’m using
onImgDidLoad
instead ofionImgDidLoad
as it seems the convention for react is to drop thei
for events? I’ve tried both, neither work.
Posts: 1
Participants: 1