JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://unpkg.com/htmx.org@1.6.0"></script>
<script src="https://unpkg.com/hyperscript.org@0.8.2"></script>
<button _="on click set the #polling-div's @data-paused to false">
  Enable Polling
</button>
<button _="on click set the #polling-div's @data-paused to true">
  Disable Polling
</button>
<hr/>
<div id="polling-div"
     hx-post="/echo/html" 
     hx-trigger="fetch"
     hx-swap="beforeend"
     hx-vals='{"html":"Polled...<br/>"}'
     _="init repeat forever 
               wait 2s then 
               if @data-paused is not 'true' then trigger fetch">
  
</div>