Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

array jsx element need key attr #174

Open
yongsheng-xia opened this issue Sep 19, 2022 · 1 comment
Open

array jsx element need key attr #174

yongsheng-xia opened this issue Sep 19, 2022 · 1 comment

Comments

@yongsheng-xia
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-chat-elements/src/ChatItem/ChatItem.tsx b/node_modules/react-chat-elements/src/ChatItem/ChatItem.tsx
index 5cb808a..b34db05 100644
--- a/node_modules/react-chat-elements/src/ChatItem/ChatItem.tsx
+++ b/node_modules/react-chat-elements/src/ChatItem/ChatItem.tsx
@@ -71,7 +71,7 @@ const ChatItem: React.FC<IChatItemProps> = ({
       <div className='rce-citem' onDragOver={onDragOver} onDragEnter={onDragEnter} onDragLeave={onDragLeave} onDrop={onDrop}>
         {!!props.onDragComponent && onDrag && props.onDragComponent(props.id)}
         {((onDrag && !props.onDragComponent) || !onDrag) && [
-          <div className={classNames('rce-citem-avatar', { 'rce-citem-status-encircle': statusColorType === 'encircle' })}>
+          <div key={'avatar'} className={classNames('rce-citem-avatar', { 'rce-citem-status-encircle': statusColorType === 'encircle' })}>
             <Avatar
               src={props.avatar}
               alt={props.alt}
@@ -103,7 +103,7 @@ const ChatItem: React.FC<IChatItemProps> = ({
               type={classNames('circle', { 'flexible': avatarFlexible })}
             />
           </div>,
-          <div className='rce-citem-body'>
+          <div key={'rce-citem-body'} className='rce-citem-body'>
             <div className='rce-citem-body--top'>
               <div className='rce-citem-body--top-title'>{props.title}</div>
               <div className='rce-citem-body--top-time'>{date && (props.dateString || format(date))}</div>

This issue body was partially generated by patch-package.

@namhsc
Copy link

namhsc commented Nov 7, 2022

 <div key={'rce-citem-body'} className='rce-citem-body'>

Not working. Don't have key unique

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants