JSFiddle - React, Tailwind, and code Playground

HTML

<img id="myImg" src="http://www.socialtalent.co/images/blog-content/so-logo.png"  style="margin-top: 3%">

JavaScript

//here will come your dynamic width
var screen ={width :300} ;

document.getElementById('myImg').style.width = screen.width + "px";