JSFiddle - React, Tailwind, and code Playground
HTML
<button>
<span id="texto-botao"></span>
</button>
CSS
button {
width: 150px;
padding: 10px;
border: 1px solid black;
margin-top: 10px;
background: white;
cursor: pointer;
}
JavaScript
function mudarTexto(i) {
if ( textos.length == i ) {
i = 0;
}
$('#texto-botao').text(textos[i]).fadeIn(500).delay(1500).fadeOut(500, function() {
mudarTexto(i + 1);
});
};
var textos = [
"Seja um cliente",
"Seja um representante"
];
$('#texto-botao').hide();
mudarTexto(0);