JSFiddle - React, Tailwind, and code Playground

HTML

<div class="x x">div </div>

JavaScript

$("div").append(
    ""+ $("div")
      .removeClass('x')
      .hasClass('x')
);