Template literals - @click problem

Hi, i need to add function with params to @click in .map() loop. If function has no parameters (@click=${editUser}), then all works correctly. But if I add params it is called automatically each time the page is render and click not worked.

<a href="#" class=“item-link item-content” @click=${editUser(index)}>

What is correct syntax to call function with parameters in @click?

<a href="#" class=“item-link item-content” @click=${() => editUser(index)} >

2 Likes

Thank you, it works!