Antd cannot use the onclick event and style property when using ts,List.Item

<List
        header={<div>list</div>}
        bordered={true}
        dataSource={props.list}
        renderItem={(item, index) => (<List.Item onClick={() => { props.handleItemDelete(index) }}>{item}</List.Item>)}
        style={{ width: "386px", marginTop: "20px" }}
      />
Prompt in

< List

[ts]
"{ header: Element; bordered: true; dataSource: any; renderItem: (item: any, index: any) => Element; style: { width: string; marginTop: string; }; }" "IntrinsicAttributes & IntrinsicClassAttributes<List> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<ListProps>, "footer" | "header" | "id" | "size" | "className" | ... 8 more ... | "locale"> & Partial<...> & Partial<...>" 
  "IntrinsicAttributes & IntrinsicClassAttributes<List> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<ListProps>, "footer" | "header" | "id" | "size" | "className" | ... 8 more ... | "locale"> & Partial<...> & Partial<...>" "style"  [2322]
(alias) class List
import List
Prompt in

< List.Item

[ts]
"{ children: any; onClick: () => void; }" "IntrinsicAttributes & IntrinsicClassAttributes<Item> & Readonly<{ children?: ReactNode; }> & Readonly<ListItemProps>" 
  "IntrinsicAttributes & IntrinsicClassAttributes<Item> & Readonly<{ children?: ReactNode; }> & Readonly<ListItemProps>" "onClick"  [2322]
(alias) class List
import List
Apr.19,2022

List is only used for the presentation of data.
since the onClick attribute is not supported, you can define the event in the child element that you pass to List.Item.


you can bind onClick, and you don't know what the problem is without providing more code.


() = > func ()

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be932d-39d17.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be932d-39d17.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?