For example, third party libraries might have issues when wrapped in a proxy. Chart.js is one of those. If you store a Chart.js instance in Alpine data, the chart will error.
I’ve been using Alpine often lately. Ryan has written a lot of good stuff on Alpine, but his reusable components post is what really got me kickstarted.
You should be careful to not abstract too early. If you are finding it difficult to manage your Alpine component from the
x-data attribute, this one is definitely for you.
The way this article builds up was very helpful: only use the level of abstraction you need:
- No abstractions
- Extract to a component function
- Mix in other data