I am using slate.js and when I delete an image by pressing backspace the image is removed from state and no longer exists. However, with the image still being stored on the server. I would like to trigger an event to delete the image from the server.
I have my image element below where I have got the image id. I want an event to be triggered on delete so I can use that id to delete the image from the backend.
export const ImageElement = ({ attributes, element }) => {
return (
<img
id='imageid'
className="rounded "
alt="uploaded image"
src={element.url}
/>
)
}
In slate.js for any element that gets removed from the state. You can use component unmounts in react on the component and trigger any deletion events from there.