How to use the $persist with Alpine.data()? #1840
-
I'm defining a component with Alpine.data(), and wish to persist some of the values of the component. There's no mention of this approach in the docs. I've tried:
But this error is thrown in the browser console: "Uncaught ReferenceError: $persist is not defined at Object" I've also tried using Has anyone gotten this to work? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You need to use a standard function.
|
Beta Was this translation helpful? Give feedback.
You need to use a standard function.
Alpine needs to bind a custom
this
to make magics available and in javascript is not possible to re-bindthis
for arrow functions.