GX2012: signal instance needs a key
A component with signals renders in a loop and has no key.
Cause
A component with signals renders in a loop and has no key. Each instance needs a key so that it has its own signals.
Example
package cart
signals {
Count int = 0
}
<button on:click={$Count++}>Add</button>package cart
props {
Names []string
}
<ul>
for range p.Names {
<li><Counter /></li>
}
</ul>gx check reports:
cart/List.gx:9:9: GX2012: component <Counter> has signals and renders in a loop; add key={expr} so each instance keeps its own signalsFix
Add key={expr} to the component call or to the element around it. Use a value that is unique for each instance.