Property 'display' does not exist on type 'HTMLIonListElement'


I have this piece of code:

    const [isThreeDotsMenuOpen, setIsThreeDotsMenuOpen] = useState<boolean>(false);
        const threeDotsIcon = useRef<HTMLIonListElement>(null);
        // const threeDotsIcon = document.getElementsByClassName("login-three-dots-menu")[0] as HTMLIonListElement;
        const openLeaveMenu = () => {
            let button = threeDotsIcon.current;
                if(button !== null)
                    button.display = "block";
                if(button !== null)
                    button.display = "none";

The ref is defined in an IonList element but it says that display does not exist in this element.
How can I make this work?
I’ve seen other posts like these: post and it didn’t work


You should use style property to update: = "block";

Answered By – Viet

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published