JSFiddle - React, Tailwind, and code Playground

HTML

<div id="time">30</div>

JavaScript

$(window).ready( function() {
    
    var time = 30
   
    setInterval( function() {
        
        if ( !localStorage.getItem('timer') ){
            
            time--;
            
            $('#time').html(time);
            
            if (time === 0) {
                
                localStorage.setItem('timer', { id: true })
                location.reload()
                
            }    
        }
                
       else {
          $('#time').html('You\'e seen this before!');
       }
        
    }, 1000 );
    
});