JSFiddle - React, Tailwind, and code Playground
HTML
<div class="my_div">
<h1 class="title"><span>This is the old text</span></h1>
</div>
CSS
.my_div {
background-color: red;
}
.my_div:hover {
background-color: green;
transition: all 500ms ease-in-out;
}
.my_div:hover .title span {
display: none;
}
.my_div:hover .title:after {
content: "A wild text appears";
}