Replies: 2 comments 1 reply
-
Alpine.data is a factory, you are creating 2 different components with their own variables. |
Beta Was this translation helpful? Give feedback.
0 replies
-
This is an issue of JS knowledge. You're reassigning the variable. Not CHANGING the value the variable points to. To demo let a = 'hello'
let b = a
a = 'world'
|
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
-
I've got a jsbin that shows what I'm trying to do here:
https://jsbin.com/saziyib/7/edit?html,console,output
The intention is that when you click "Change A to Hello" or "Change B to World" that it changes the variables in the parent. I suspect that for some reason (of my doing!) it is just changing a locally scoped variable instead of affecting the parent references (a, and b).
Is it possible to achieve what I'm after? I need 'a' and 'b' to change within the parent container, when the component created by Alpine.data is actuated.
Beta Was this translation helpful? Give feedback.
All reactions