Replies: 1 comment
-
If you want to use this at the top level, you need to use a standard function. Alpine.data('dropdown', function() {
return {
open: $persist(false),
toggle() {
this.open = !this.open
},
}
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How do we register a variable as a
$persist
value inside re-usable components?For example, the following code will return an error that says
$persist is not defined
. The'this
(as inthis.$refs
etc) keyword will not work on Top-level either.Beta Was this translation helpful? Give feedback.
All reactions