score:0

import React from 'react'
import axios from 'axios'
const baseUrl = 'http://localhost:3001/persons'


const deleteContact = (id)=>{
  const request = axios.delete('{$baseUrl}/${id}')
  request.then(response =>response.data)
  }

const Person = ({ person, deleteContact }) => {
   console.log("person.js props "+person.id)
   
    return (
      <li> 
        {person.name} {person.number}  
        <button onClick={()=>deleteContact(person.id)}>Delete {person.id} </button> 
      </li>
    )
  }

  export default Person

Related Query

More Query from same tag