how is the correct id sent to onDelete? I am not sending any id in the onClick, so how does the onDelete knows which id is being passed to it?

import React from "react";

function Note(props) {
  
  function handleClick() {
    console.log(props.id);
    props.onDelete(props.id);
  }

  return (
    <div className="note">
      <h1>{props.title}</h1>
      <p>{props.content}</p>
      <button onClick={handleClick}>DELETE</button>
    </div>
  );
}

export default Note;

48 thoughts on “how is the correct id sent to onDelete? I am not sending any id in the onClick, so how does the onDelete knows which id is being passed to it?”

Leave a Comment