JSFiddle - React, Tailwind, and code Playground

HTML

<div id="blink" style="height:400px">
    <p><span class="blackwhite">Black text, white background</span><span class="whiteblack">White text, black background</span></p>
</div>

CSS

.background{
	background: black;
}

.blackwhite {
	color:black;
	text-shadow: 0 0 5px #FFF;
}

div#blink {
    height: 10em;
    position: relative
}

div#blink p {
    margin: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-right: -50%;
    transform: translate(-50%, -50%);
}

.whiteblack {
	color:white;
	text-shadow: 0 0 5px #000;
}

JavaScript

var backgroundInterval = setInterval(function(){
    $("#blink").toggleClass("background");
 },50);