Skip to content

Commit 9a632bf

Browse files
use lodash uniqueId for sidebar-item key generation to avoid duplicate key error
1 parent ceadfd4 commit 9a632bf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

components/sidebar-item/sidebar-item.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { uniqueId } from 'lodash';
23
import Link from '../link/link';
34

45
const block = 'sidebar-item';
@@ -36,7 +37,7 @@ export default class SidebarItem extends React.Component {
3637
anchors.map(anchor => (
3738
<li
3839
className={ `${block}__anchor` }
39-
key={ `anchor-${title}-${anchor.id}` }>
40+
key={ `anchor-${title}-${uniqueId()}` }>
4041
<a href={ this._generateAnchorURL(anchor) }>
4142
{ anchor.title }
4243
</a>

0 commit comments

Comments
 (0)