# Prevent Hidden Element From Flickering On Load Here is what it might look like to use [Alpine.js](https://alpinejs.dev/) to sprinkle in some JavaScript for controlling a dropdown menu. ```html
``` Functionally that will work. You can click the button to toggle the menu open and closed. What you might notice, however, when you refresh the page is that the menu flickers open as the page first loads and then disappears. This is a quirk of the element being rendered before Alpine.js is loaded and the [`x-show`](https://alpinejs.dev/directives/show) directive has a chance to take effect. To get around this, we can _cloak_ any element with an `x-show` directive that should be hidden by default. ```html ``` This addition needs to be paired with some custom CSS to hide any _cloaked_ elements. ```css [x-cloak] { display: none !important; } ``` [source](https://alpinejs.dev/directives/cloak)