JSFiddle - React, Tailwind, and code Playground

HTML

<div class="bg" id="divBackground">Test</div>

CSS

.bg
{
    background-color:Black;
    color:White;
    width:100%;
}

JavaScript

var h = window.innerHeight;
document.getElementById('divBackground').height = h + 'px';

window.onresize = function (event) {
    document.getElementById('divBackground').style.height = h + 'px';
}

alert(h);