JSFiddle - React, Tailwind, and code Playground

HTML

<button id="toggle-box">toggle</button>
<div id="box"></div>

CSS

#box {
    background-color: grey;
    height: 200px;
    width: 200px;
}

JavaScript

$('#toggle-box').click().toggle(function() {
    $('#box').animate({ width: 'hide' });
}, function() {
    $('#box').animate({ width: 'show' });
});