Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alpine nested x-data

I am trying to learn Alpine and I am testing out nested x-data. I came across a GitHub issue with nested x-data. They provided a solution which I wanted to try out myself. However, when I try to replicate the code, it didn't print anything. There are no errors in the console too. Can anyone guide me as to what I did wrong?

<div x-data="{foo: 'bar'}">
        <div x-data="{ }">
            <span x-text="foo"></span>
        </div>
</div>

I also tried using the $el property but it produced the same result.

like image 775
Reon Low Yiyuan Avatar asked Jun 09 '26 00:06

Reon Low Yiyuan


1 Answers

In version 3 of alpinejs this issue has been solved. Nothing needs to be done.

like image 90
Puneet Sharma Avatar answered Jun 11 '26 14:06

Puneet Sharma