x-ref not working without reason? #4341
-
I really love AlpineJS, but things like this really bring me over the edge sometimes. I have the very similar two buttons that actually are siblings (so same hierarchy):
The x-ref for search works, while the x-ref for myflicks doesn't, appears without reason? They are being called within the very same function:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 13 replies
-
And this is the output of the console.warn()
|
Beta Was this translation helpful? Give feedback.
-
OK, I see, thanks. Sorry, I think I knew this sometime ago... So, when I put a label around the button without making it a component, it works. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Generally using You can get something more like what you might want using just like |
Beta Was this translation helpful? Give feedback.
By design, a parent component cannot see scope variables and references defined in a child component (the other direction works). You can see in the xref source code why.