-
I'm experimenting with the CSP build, and everything seems straightforward except for one thing: passing arguments/"props" into a data object. I found discussions from 2021 in which data attributes are recommended (1, 2). That works, but I'm wondering if there have been any new developments since then. In particular, are there any conveniences around getting values from data attributes, as in Stimulus? Stimulus actually came up in one of those 2021 discussions. It doesn't look like anything came of it, and I haven't see anything like this in the docs, but I just wanted to make sure. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Any such conveniences could be pretty simple with a custom directive. |
Beta Was this translation helpful? Give feedback.
You can add the effect on the next tick or something like that (although then you have the problem that init won't see $props, basically both directives need to wait for the other ones) but, to be fair, it feels like it could be less complex.
Alpine allows you to add data layers to a specific context so you can have something like this: https://codepen.io/SimoTod/pen/QWevogX
Those are oversimplified examples but they may help you decide how to approach it.