mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
fix: Respect user provided space item key (#35344)
This commit is contained in:
parent
6c0f67e407
commit
10596d9604
@ -88,15 +88,12 @@ const Space: React.FC<SpaceProps> = props => {
|
||||
latestIndex = i;
|
||||
}
|
||||
|
||||
const keyOfChild = child && child.key;
|
||||
// Add `-space-item` as suffix in case simple key string trigger duplicated key warning
|
||||
// https://github.com/ant-design/ant-design/issues/35305
|
||||
const defaultKey = `${i}-space-item`;
|
||||
const key = child && child.key || `${itemClassName}-${i}`;
|
||||
|
||||
return (
|
||||
<Item
|
||||
className={itemClassName}
|
||||
key={`${itemClassName}-${keyOfChild || defaultKey}`}
|
||||
key={key}
|
||||
direction={direction}
|
||||
index={i}
|
||||
marginDirection={marginDirection}
|
||||
|
Loading…
Reference in New Issue
Block a user