JSFiddle - React, Tailwind, and code Playground
HTML
<script>
function fadeIn(elem, speed) {
if(!elem.style.opacity)
{
elem.style.opacity = 0;
}
setInterval(function(){
elem.style.opacity = parseFloat(elem.style.opacity) + 0.03;
}, speed /100);
}
</script>
<div id="hey">
</div>
CSS
#hey {
background-color: red;
width: 100px;
height: 100px;
}
JavaScript
ele = document.getElementById('hey');
fadeIn(ele, 4000);