JSFiddle - React, Tailwind, and code Playground

HTML

<div style="display:none">
    <div id="foo" style="width:100px;height:100px">hi</div>
</div>

JavaScript

function isHidden(elem) {
    return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;    
}

foo = document.getElementById("foo")
alert(isHidden(foo))