-
I see that my mini-cart Alpine component is loading before CartJS is initialized no matter what order I import the libraries. I'm kinda understanding that if you pass the CartJS object to the component through x-data, that it doesn't seem to watch for changes to CartJS once it's initialized. I can however, see the CartJS data in the Alpine.js devtools, but my x-html output still shows undefined. Little confused about this discrepancy too. Not exactly sure how this would be done. I see a couple threads on how to init a component asynchronously, but I don't totally understand how this is done. Any help on this would be appreciated. thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It depends on what you want to do. |
Beta Was this translation helpful? Give feedback.
It depends on what you want to do.
If you just need to call cartJS.init(), you can do it in your x-init but yeah, the reactivity in Alpune only works with plain object so changing your cartJS instance won't update the page.