template x-for, how to use the "key" keyword #3630
-
Hi Team, I am learning alpine, and see template x-for, which has key this keyword, and I try to explore the value from loop, but it failed, it said key is not defined, how to figure this out? Thanks |
Beta Was this translation helpful? Give feedback.
Answered by
ekwoka
Jun 20, 2023
Replies: 2 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
0 replies
-
The key isn't available in the state. It's only used internally by the You don't access it, it is simply used to keep track of which elements are what during looping. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ericxin1982
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The key isn't available in the state.
It's only used internally by the
x-for
directive.You don't access it, it is simply used to keep track of which elements are what during looping.