qwik
qwik copied to clipboard
[DOCS] Mention the need to key child components when built from an array
How can the documentation be improved?
Currently, there is no mention of a key
attribute.
I recently run into a weird bug where my child components did not update as expected and their props changes were not being tracked in useClientEffect
and so did not update as expected.
Eg, adding key
in something like this fixed the problem:
{items.map((item) => (
<Component
key={item.foo}
foo={item.foo}
/>
))}
For docs, it could be mentioned in the Rendering section I suppose. Not knowing it could be a keying issue I kind of browsed around the Component API sections.
I tried to look for key or array in the search to see if that was mentioned elsewhere.
Some might expect it to be mentioned in the Reactivity section perhaps.