JSFiddle - React, Tailwind, and code Playground
HTML
<div id="loading"></div>
CSS
#loading{
font-size: 64px;
font-family: monospace;
text-align: center;
margin: 32px 0;
}
JavaScript
const loading = ['/', '⎯', '\\', '|'];
let count = 0;
const changeLoading = setInterval( () => {
document.getElementById("loading").innerHTML = loading[count];
count++;
if( count > 3 ){
count = 0;
}
}, 110);