I want to pass the int i into the button onclick function for each list item. I expected the \"clickItem\" function will receive 0..2 for correspondig list item. But it come
This is a classic, but slightly new in the context of Blazor.
You need to make a copy because otherwise the lambda 'captures' the loop variable. Capturing the copy is OK.
@for (int i = 0; i < 3; i++) { int copy = i; item @i clickItem(copy))>Click }