I'm in need of getting the width of the browser when i resize the browser in real time. So far i've found a solution which gives the width but it's not in real time. The value is updated only after i refresh the web page. How can i get the value as i resize the browser.
My approach
render() {
var windowWidth = window.innerWidth;
return (
<div className="body_clr">
{windowWidth}
</div>
)
}
This solution works if i refresh the page. But i want to get the width as i resize because i have to execute a function at a specific screen size.