Skip to content

Commit

Permalink
docs: indicate that menu items require keys (#35474)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonywu6 committed May 11, 2022
1 parent b4ae920 commit 68a2f8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions components/menu/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ ReactDOM.render(<Alert message="After version 4.20.0, we provide a simpler usage
```jsx
// works when >=4.20.0, recommended ✅
const items = [
{ label: 'item 1' },
{ label: 'item 2' },
{ label: 'item 1', key: 'item-1' }, // remember to pass the key prop
{ label: 'item 2', key: 'item-2' }, // which is required
{
label: 'sub menu',
children: [{ label: 'item 3' }],
key: 'submenu'
children: [{ label: 'item 3', key: 'submenu-item-1' }],
},
];
return <Menu items={items} />;
Expand Down
7 changes: 4 additions & 3 deletions components/menu/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ ReactDOM.render(<Alert message="在 4.20.0 版本后,我们提供了 <Menu ite
```jsx
// >=4.20.0 可用,推荐的写法 ✅
const items = [
{ label: '菜单项一' },
{ label: '菜单项二' },
{ label: '菜单项一', key: 'item-1' }, // 菜单项务必填写 key
{ label: '菜单项二', key: 'item-2' },
{
label: '子菜单',
children: [{ label: '子菜单项' }],
key: 'submenu',
children: [{ label: '子菜单项', key: 'submenu-item-1' }],
},
];
return <Menu items={items} />;
Expand Down

0 comments on commit 68a2f8b

Please sign in to comment.