Skip to content
Discussion options

You must be logged in to vote

localStorage saves and retrieves everything as strings. The string false is a truthy value so it works as expected.
You need to change your x-data to x-data="{darkMode: localStorage.getItem('dark') === 'true'}"

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@DarpanKulkarni
Comment options

Answer selected by DarpanKulkarni
Comment options

You must be logged in to vote
1 reply
@ekwoka
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants