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 readCookie(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;
}

var showPopup = readCookie('dontShow');

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