JSFiddle - React, Tailwind, and code Playground

HTML

<div class="parent">
  <div class="child"></div>
</div>

CSS

.parent {
  width: 200px;
  height: 20px;
  background-color: black;
}

.child {
  width: 20%;
  height: 100%;
  background-color: orange;
}

JavaScript

setInterval(function() {
  document.getElementsByClassName("child")[0].style.width = `${Math.random() * 100}%`;
}, 300);