import '../styles/List.css'; import { useState } from 'react'; const List = ({data}) => { const [reload, setReload] = useState(0); async function deleteEntity(id) { fetch("/delete", { // Adding method type method: "DELETE", // Adding body or contents to send body: JSON.stringify({id}), // Adding headers to the request headers: { "Content-type": "application/json; charset=UTF-8" } }) .then(res => res.text()) .then(message => {console.log(message)}) } return ( {data.map((e, i) => { try { const url = new URL(e.link) return } catch (e) { console.log(e) } })}
# Name Title Link Tag
{i + 1} {e.name} {e.title} {url.hostname} {e.tag} deleteEntity(e._id)}>
x
) } export default List