Closed oliverbj closed 4 years ago
Hi @oliverbj,
This isn't directly related to Alpine, it's related to your Models so I'm going to close this issue.
It might make more sense to post this in the Laravel Discussions or on a forum. I can tell you now though that each time you output one of the modal components, you're loading the user and their tasks each time, you'd be better if loading the user and the tasks a single time, then passing that same instance through to the Livewire component.
Hi there!
I have tried to create a modal using Alpine.js and Livewire, together with a simple blade component.
Consider below:
As you can see, when you click the "Open Modal", it will show the blade component. The blade component looks like this:
So far so good. The modal can open and close. However, as you can see in the above code, the blade component includes a
@livewire()
view. In my case, it looks like this:Now consider that you have this set up in a foreach loop in your blade view:
As you can see, it increases the Model count immensely as well as the view count.
Am I missing something here? Anyone got a better approach?