x-data assignment, is object or function? #4129
Closed
ericxin1982
started this conversation in
4. General
Replies: 1 comment 1 reply
-
If you are passing it to Alpine.data it must be a function that returns an object When writing it in x-data, it needs to be an expression that evaluates to an object or to a function that returns an object. All Alpine expressions are encapsulated into functions already. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have a general question, somewhere I saw example x-data = {}, somewhere I saw example x-data=variable, and variable = (x) => ({}) defined in script section, and I am not sure when I should use {}, when I should use function, or I can just use function always.
Thanks for help me clarify this.
Thanks
Eric Xin
Beta Was this translation helpful? Give feedback.
All reactions