Problem statement There might be cases when you would be required to obtain metadata of a media before it is loaded. The usual way you would go about it is to have an API that gives back the media metadata from the server. But here we will be getting the image dimension using React.
Steps to solution Firstly, we will be creating an instance of the HTML Image element and then pass the image URL.
I hail from Himalayas of Nepal who grew up playing alongside Yeti,
the mythical beast. ;)
I recall the start of my love and passion for coding since mid-2000 when
I first got introduced to QBasic. At present, I am working in DevOps but
I am passionate about various engineering domains, product, and
developer relations. I can wear different hats as needed.
In my spare time, I relish to go out for trekking, listen to acoustic music, play the guitar, and
contribute to Wikipedia.