Skip to content

1000 event listners got created in this code? #1129

Answered by KevinBatdorf
sqllyw asked this question in 1. Help
Discussion options

You must be logged in to vote

not a good practice when the number is getting big?

That's correct, it's probably not a good idea to write your code like that. Instead you can do something like this:

 <div x-data="" x-on:click="alert($event.target.textContent)">   
    <template x-for="i in 1000">
    	<span x-text="i"></span>
    </template>
</div>

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by HugoDF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants