Using local storage to keep a check box checked (javascript)

I’m trying to have a checkbox keep it’s state in local storage and I’m having some issues. If the box os checked, a DIV is visible and if unchecked the DIV hides itself. When the browser refreshes the checkbox resets. I’ve tried several sources online and they all have me constructing it a different way, here’s what I have now:

If the variable is not null set it to what’s in local storage.
If the variable is null , set it to checked.
Where am I going wrong?

 const switchBtn = document.createElement('input');
    switchBtn.setAttribute('type', 'checkbox');
    switchBtn.setAttribute('id','switchBtn');
    let checkStatus = localStorage.checkStatus;
        if(checkStatus != null){
            let checkStatus = localStorage.checkStatus;
        }
        if(checkStatus == null){
            let checkStatus = switchBtn.checked = true;
        }
    switchBtn.addEventListener('click', ()=> {
        if (switchBtn.checked == true){
            triageBar.style.display = "block";
            localStorage.checkStatus = switchBtn.checked = true;

        } else {
            triageBar.style.display = "none";
            localStorage.checkStatus = switchBtn.checked = false;
        }
       })