MCPcopy
hub / github.com/facebook/react / ListItem

Function ListItem

packages/react-devtools-shell/src/app/ToDoList/ListItem.js:22–47  ·  view source on GitHub ↗
({item, removeItem, toggleItem}: Props)

Source from the content-addressed store, hash-verified

20};
21
22function ListItem({item, removeItem, toggleItem}: Props) {
23 const handleDelete = useCallback(() => {
24 removeItem(item);
25 }, [item, removeItem]);
26
27 const handleToggle = useCallback(() => {
28 toggleItem(item);
29 }, [item, toggleItem]);
30
31 return (
32 <li className={styles.ListItem}>
33 <button className={styles.IconButton} onClick={handleDelete}>
34 🗑
35 </button>
36 <label className={styles.Label}>
37 <input
38 className={styles.Input}
39 checked={item.isComplete}
40 onChange={handleToggle}
41 type="checkbox"
42 />{' '}
43 {item.text}
44 </label>
45 </li>
46 );
47}
48
49export default (memo(ListItem): component(...props: Props));

Callers

nothing calls this directly

Calls 1

useCallbackFunction · 0.90

Tested by

no test coverage detected