F
Filament17mo ago
BATMAN

looping components that have custom javascript in it.

Hi i have a custom page that shows a list of components by looping it and each component has js in it. The js is stacked on top of one another as each component is loaded initially. There is filtering function that shows specific records. However, the stacked js is still loaded and is crashed due to the lack of specific components, (since some records are not shown, and js is asking for the values of the missing components). Is there a way where i can load the js according to the components it has filtered?
1 Reply
Patrick Boivin
Patrick Boivin17mo ago
I think this is a good case for extracting Alpine.js components instead of inline <script> tags https://alpinejs.dev/directives/data#re-usable-data
Want results from more Discord servers?
Add your server