I have a React Server Side rendered component with img
tag. I want to attach an onload
event listener on the image tag and made the component like below:
render () {
return (
<img onLoad={() => { console.log('Image loaded'); }} src='/abc.jpg'/>
)
}
Ideally React's renderToString
method should have generated an HTML template like below:
<img onload='function () { console.log('Image loaded'); }' src='/abc.jpg' />
but it doesn't. What am I missing? I checked there was a similar issue here but with no solution