score:0
Accepted answer
you need to filter out inside handledelete
like this:
handledelete = (name) => {
const newstate = [...this.state.names].filter((data) => !(data === name));
this.setstate({ names: newstate });
};
and pass name property from chip
like this:
<chip
size="small"
avatar={
<avatar
alt="pre"
src={this.state.imagespreviewurls.map((imagepreviewurl) => {
return <img alt="previewimg" src={imagepreviewurl} />;
})}
/>
}
label={name}
ondelete={() => this.handledelete(name)}
/>
);
here is the demo: https://codesandbox.io/s/material-ui-confirm-demo-forked-e3b1t?file=/src/demo.js:2346-2774
Source: stackoverflow.com
Related Query
- Delete Image uploaded Material UI
- Does Material UI have an Image component?
- Image on Material UI CardMedia
- How to add custom `PNG` image to material ui icon
- Why I cant see image in the example of material -ui-v3.2.0 "Image avatars "
- Use material ui svg icons as background image
- Preview of uploaded image in React js using React hooks
- how to place image in material ui button by passing startIcon prop
- Draft.js cannot insert uploaded image from external form
- CardMedia in Material UI not picking up the image
- base64 encoded image not dispaying in material ui CardMedia
- Adding CSS background image to Material UI theme
- How to add background image on a material ui Dialog component
- How to delete a specific textfield inside a table onclick of a button using reactjs & material ui
- Material UI Chip cross button / delete button not working
- How to display image which was uploaded by Multer when query data with Mongoose
- How to delete chips in Material UI
- Not able to add, update, delete rows in material table react using class based component. Previously it was working with functional component
- Not able to reduce the size of image in Material UI CardMedia in a React component
- React: Image uploaded from node js backend is not rendering
- Material UI Carousel autoplay and loading image issue
- React state is always one step behind while making predictions on uploaded image using Tensorflowjs
- Material UI image on Toolbar
- Material Ui (reactjs) - Center a logo image in the appBar
- Display an image and text in a checkbox label using Material UI
- How to change with fallback image with Material ui?
- How I can add image in material table cell?
- How to delete a specific row in Material UI DataGrid (Reactjs)
- Image in Grid Item overflowing in React using Material UI
- Material UI : How to use my own image in avatar
More Query from same tag
- If there are both componentWillReceiveProps and onSubmit, we want to give priority to onSubmit
- how to make a grid item that uses remaining gridspace in reactjs material-ui?
- trying to make a React dropdown with checkbox options in it and its not working properly
- Slide Up Transition of React Component
- Saving array of objects in state and passing it to return to display it on web page in react
- How to link different react pages?
- How to render array of object?
- reactjs passing a callback results in undefined
- CORS request did not succeed - react
- useSWR to get get data of specific ID
- How do I use React Modal with a map function?
- How to edit a recieved JSX element to attach a prop to any img element inside it?
- Annotating Custom React Hook With TypeScript
- MUI: How to delete selected rows in DataGrid programmatically?
- TypeError: Cannot read property 'localtime' of undefined
- Merge keys in JSON object to return an array of merged keys and the value with Javascript
- TypeScript + React: Element type is invalid: expected a string (for built-in components)
- How to merge multiple functions into one function
- Why does my dynamic import make 2 network request?
- I am using react useState hook, but its not working
- Can I pass props to the children via props.children React JS
- setState value used in componentDidMount is not reflected in Enzyme test
- Using loop to create elements in react
- Jest mock function does not register call
- Cannot get ref to MapView - react-native-maps
- React.js: useState Hook Setter is not updating the state
- How to use scss variables in create react app?
- Reactjs: Error: HomePage(...): Nothing was returned from render
- Cannot Read Property 'state' of undefined for this.state
- How to get updated object array in extended class javascript