JSFiddle - React, Tailwind, and code Playground

HTML

<div id="cookie-status"></div>

JavaScript

document.cookie = 'dontShow=1; expires=Wed, 01 Jan 2020 12:00:00 GMT; path=/';

(function($) {
    $.fn.readCookie = function(option) {
        var optionEQ = option + '=';
        var ca = document.cookie.split(';');
    
        for(var i = 0; i < ca.length; i++) {
            var c = ca[i];
    
            while(c.charAt(0) === ' ') {
                c = c.substring(1, c.length);
            }
    
            if (c.indexOf(optionEQ) === 0) {
                return c.substring(optionEQ.length, c.length);
            }
        }
    
        return false;
    }
})(jQuery);

if (!$(document).readCookie('dontShow')) {
    $('#cookie-status').html('<p>Cookie not set.</p>');
} else {
    $('#cookie-status').html('<p>Cookie has been set.</p>');
}