我使用 react-js 和 Material-ui 芯片我添加了很多芯片,然后一个芯片显示了文本。我想要删除芯片的功能。但我不能如何删除它。
我怎样才能删除它onDelete={}
?
这只是我的代码的一部分:
import React, { useEffect, useState, Component } from 'react'
import Chip from '@material-ui/core/Chip'
const useStyles = makeStyles(theme => ({
root: {
display: 'flex'
},
chip: {
backgroundColor: '#104d56'
},
}))
const handleDelete = () => {
console.log(hashtag);
};
const studentlist = []
function ResponsiveDrawer(props) {
{
namefamily.map((item, index) => {
if (index + 1 > namefamily.length - gpcapacity) {
if (showstu == item[2]) {
studentlist.push(
<Chip
key={item[2]}
className={classes.chip}
clickable={false}
variant="outlined"
label={
<Typography variant="caption" color="textSecondary">
{item[0]} {item[1]}
</Typography>
}
onDelete={handele}
icon={<FaceIcon />}
/>
)
} else
studentlist.push(
<Chip
key={item[2]}
variant="outlined"
clickable={true}
label={
<Typography variant="caption" color="textSecondary">
{item[0]} {item[1]}
</Typography>
}
icon={<FaceIcon />}
/>
)
}
})
}
}
handleDelete()
函数内部会是什么?