JSFiddle - React, Tailwind, and code Playground

HTML

<button class="btnAdd">add new LI</button>
<button class="btnRemove">remove last LI</button>
<ul></ul>
<div>test</div>

CSS

ul:empty {}

ul + div {
    animation: repaint 1000s infinite linear;
}

ul:empty + div {
    color: red;
}

@keyframes repaint {
    from { zoom: 1; }
    to { zoom: 0.99999; }
}

JavaScript

$('.btnAdd').on('click', function () {
    $('ul').append('<li>LI</li>');
});

$('.btnRemove').on('click', function () {
    $('ul').find('li').last().remove();
});