Forráskód Böngészése

Avoid passing img prop to entire ListItem component

Tatiana Inama 6 éve
szülő
commit
a5af8513b2
1 módosított fájl, 2 hozzáadás és 3 törlés
  1. 2 3
      recipes/src/components/List/index.tsx

+ 2 - 3
recipes/src/components/List/index.tsx

@@ -35,7 +35,6 @@ const AvatarGraphic: FunctionComponent<{
 );
 
 export const List: FunctionComponent<ListProps> = ({ items, className, listItemClassName, avatarList, ...props }) => {
-  
   return (
     <RMWCList
       {...props}
@@ -44,12 +43,12 @@ export const List: FunctionComponent<ListProps> = ({ items, className, listItemC
       className={cx('cbk-list', className)}
     >
       {
-        items.map((item, i) => {
+        items.map(({img, ...item}, i) => {
           return (
             <SimpleListItem
               { ...item }
               graphic={avatarList ? (
-                <AvatarGraphic img={item.img}/>
+                <AvatarGraphic img={img} />
               ) : undefined }
               key={i}
               className={cx(listItemClassName, 'cbk-list__item')}