@jamiechong wrote:
I’m trying to add a
loadedclass toIonImgwhen the image loads. According to docs I should be able to listen to aionDidLoadevent. 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
onImgDidLoadinstead ofionImgDidLoadas it seems the convention for react is to drop theifor events? I’ve tried both, neither work.
Posts: 1
Participants: 1