Skip to content

Commit 1ac2b12

Browse files
authored
Prevent key warning in react (#784)
1 parent 86575b4 commit 1ac2b12

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/react/utils/src/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,15 @@ export function For<T>(props: ForProps<T>): JSX.Element | null {
5050

5151
const items = list.map((value, key) => {
5252
if (!cache.has(value)) {
53-
return <Item v={value} i={key} children={props.children} cache={cache} />;
53+
return (
54+
<Item
55+
v={value}
56+
key={key}
57+
i={key}
58+
children={props.children}
59+
cache={cache}
60+
/>
61+
);
5462
}
5563
return cache.get(value);
5664
});

0 commit comments

Comments
 (0)