Skip to content

W0103: A stateful component in a loop has no key ​

A stateful component (one embedding ui.Live) made in a loop, with no key on it or on the item holding it, is told apart from the others by its order: an item inserted before it hands it another item's instance, state and all. Reported by vukavet.

Wrong ​

html
for _, it := range Items {
  <Counter label={it.Name}/>
}
html
for _, it := range Items {
  <Counter key={it.ID} label={it.Name}/>
}

Released under the MIT License. Vuka builds on Go and its tools, which are made by the Go Authors. Vuka is not affiliated with Google or the Go project. Go is a trademark of Google LLC.