Skip to content

Commit 64b1fe9

Browse files
authored
Merge pull request #1064 from ryandrewjohnson/bug/example-link-multiplies-onscroll
Fix issue with sidebar-item with duplicate key attributes
2 parents ecb615c + 9a632bf commit 64b1fe9

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)