Skip to content

Commit bc58399

Browse files
committed
Option elements shouldn't have keys based on index
1 parent dcbf07c commit bc58399

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/Select2.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ export default class Select2 extends Component {
153153
return type === 'function' || (value && type === 'object') || false;
154154
}
155155

156-
makeOption(item, k) {
156+
makeOption(item) {
157157
if (this.isObject(item)) {
158158
const { id, text, ...itemParams } = item;
159159
return (<option key={`option-${id}`} value={id} {...itemParams}>{text}</option>);
160160
}
161161

162-
return (<option key={`option-${k}`} value={item}>{item}</option>);
162+
return (<option key={`option-${item}`} value={item}>{item}</option>);
163163
}
164164

165165
render() {
@@ -180,11 +180,11 @@ export default class Select2 extends Component {
180180
const { children, text, ...itemParams } = item;
181181
return (
182182
<optgroup key={`optgroup-${k}`} label={text} {...itemParams}>
183-
{children.map((child, k2) => this.makeOption(child, `${k}-${k2}`))}
183+
{children.map((child) => this.makeOption(child))}
184184
</optgroup>
185185
);
186186
}
187-
return this.makeOption(item, k);
187+
return this.makeOption(item);
188188
})}
189189
</select>
190190
);

0 commit comments

Comments
 (0)