qwik icon indicating copy to clipboard operation
qwik copied to clipboard

[DOCS] Mention the need to key child components when built from an array

Open jwickers opened this issue 2 years ago • 0 comments

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.

jwickers avatar Nov 17 '22 09:11 jwickers