JSFiddle - React, Tailwind, and code Playground

HTML

<div class="App">
  <h1>
  <div class="preloader"></div>
    Hello CodeSandbox
  </h1>
  
</div>

CSS

.App {
  font-family: sans-serif;
  text-align: center;
}

.preloader-wrapper {
  position: relative;
}
.preloader {
  display: block;
	width: 100%;
	height: 100%;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: #cccccc;
	position: absolute;
	z-index: 1;
	border-radius: 0.5em;
}

JavaScript

const myElement = document.querySelector('.preloader');
myElement.parentElement.classList.add('preloader-wrapper');