Updating Alpine's DOM without user-interaction #585
tiptronic
started this conversation in
4. General
Replies: 1 comment 3 replies
-
Only changes triggered by the component are reactive. If you need external changes, you need to use events to notify the component that something has changed. The component will listen for that event on the window object and you can update a timestamp variable which will trigger the reactivity. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there,
maybe I'm misunderstanding something, but here's what I can't figure out:
I have some external data, e.g 'itemList':
and that's in the page:
Now, if I update
itemList
I'd expect the DOM gets updated... but it doesn't...If I create a second node and initalize Vue with it (sticking the
itemList
variable into the Vue-instances' data portion), Vue's part gets updated, but Alpine's doesn't.If I put some link inside the '.alpine' node - which then inserts a new item - both (Vue and Alpine) are properly updated.
So my question is: How can I update the DOM without user-input? (e.g. by regularily fetching data)
Or does Alpine only provide reactivity in response to user-interaction?
Any hint?
Beta Was this translation helpful? Give feedback.
All reactions