DEV Community

Abhi Raj
Abhi Raj

Posted on

How to hide Zendesk web widget in react


  useEffect(() => {
        setTimeout(() => {
            const iframeElement = document.getElementById('launcher');
            if (iframeElement) {
                iframeElement.style.display = 'none';
            }
        }, 1000); // wait for 1 second
    }, []);


Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
toanbku profile image
Ho Quang Toan

"setTimeout" has never been a stable solution for interacting with the DOM in React. A better alternative that can be used is the "MutationObserver"