You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importReactfrom"react";importReactDOMfrom"react-dom";import{version,Button,Mentions}from"antd";import"antd/dist/antd.css";import"./index.css";const{ Option }=Mentions;constusers=[{userName: 'Jessica',useId: '1'},{userName: 'Jessica',useId: '2'}];ReactDOM.render(<divclassName="App"><h1>Please fork this codesandbox to reproduce your issue.</h1><div>Current antd version: {version}</div><divstyle={{marginTop: "16px"}}><Mentionsrows='3'style={{width: '100%'}}>{users&&users.map((item)=>{return(<Optionkey={`user-${item.userId}`}value={item.userName}className='avatar'><spanid={item.userId}>{item.userName}</span></Option>);})}</Mentions><Buttontype="primary">Example button</Button></div></div>,document.getElementById("root"));
报警示:
【Warning: Encountered two children with the same key, .0:$Jessica.】
Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
What is expected?
应该考虑到被@名单中有重名的情况。
What is actually happening?
实际上直接将value传入Mention中的组件,作为key了。
Environment
Info
antd
3.22.0
React
16.3
System
3.22.0
Browser
76.0.3809.100
The text was updated successfully, but these errors were encountered:
Reproduction link
https://wk04r016q8.csb.app/
Steps to reproduce
报警示:
【Warning: Encountered two children with the same key,
.0:$Jessica
.】Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
What is expected?
应该考虑到被@名单中有重名的情况。
What is actually happening?
实际上直接将value传入Mention中的组件,作为key了。
The text was updated successfully, but these errors were encountered: