Skip to content

Instantly share code, notes, and snippets.

@rodolfojnn
Last active January 3, 2022 13:48
Show Gist options
  • Save rodolfojnn/5f031b132d01810c56d6769c30e0a0d5 to your computer and use it in GitHub Desktop.
Save rodolfojnn/5f031b132d01810c56d6769c30e0a0d5 to your computer and use it in GitHub Desktop.
<script>
document.addEventListener('alpine:init', () => {
Alpine.store('darkMode', {
on: false,
toggle() {
this.on = ! this.on
}
})
})
</script>
<div x-data :class="$store.darkMode.on && 'bg-black'">...</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment