In a list, each list item has an "AddIcon". When clicked I would like to switch that icon to a "BlockIcon" according to it's "id"
import React from 'react'
import {List, ListItem} from '@material-ui/core'
import AddCircleIcon from '@material-ui/icons/AddCircleOutline'
import BlockIcon from '@material-ui/icons/BlockOutlined'
const StackOverflow = () => {
const handleIconClick = (id) => {
// change <AddCircleIcon /> to <BlockIcon /> at "id"
}
return (
<List component="nav">
<ListItem>
<ListItem button onClick={handleIconClick(101)}>
<AddCircleIcon />
</ListItem>
</ListItem>
</List>
)
}
export default StackOverflow
When icon is clicked, I expect the AddIcon to change to a BlockIcon.