JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://thorst.github.io/jquery-idletimer/prod/src/idle-timer.js"></script>
<h3>This has a 3 second timeout</h3>
<span id="state">active</span>

JavaScript

(function ($) {
      
    $( document ).on( "idle.idleTimer", function(event, elem, obj){
        $("#state").html("idle");
    });
    
    $( document ).on( "active.idleTimer", function(event, elem, obj, triggerevent){
        $("#state").html("active");
    });
    
    $.idleTimer(3000);
    
})(jQuery);