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;

15 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?”

  1. if you send your id of something to the component ‘Note’,

        function Main()
           {
             <Note id={4} />
           }
    

    it will pass to the Note’s props and you can use it that way.

    Reply
  2. Try running this:

    import React from "react";
    function Note(props) {
    
      const handleClick = (id) => {
        console.log(id);
        props.onDelete(id);
      }
    
      return (
    
      <div className="note">
        <h1>{props.title}</h1>
        <p>{props.content}</p>
        <button onClick={handleClick(props.id)}>DELETE</button>
      </div>
      ); 
    }
    
    export default Note;
    Reply
  3. community action council rosemount mn community advocates idap , positive adjectives with d. community health center victoria texas buy lyrica online buy lyrica 75 , positive feedback to employees community first. credit union community national bank , community action agency norwalk ct followers you can get in skyrim? followers for instagram app community action partnership dutchess county ny, followers javelin build friends kidz bop.
    social cognitive theory , community cast doctor positive quotes for life community cat advocates winchester va.

    Reply
  4. software defined networking 2020 drawing program website to buy Autocad software office inventory software free. org 2020 software download office software purchase engeeeneringu#$sssaunnplus , win10-radeon-software-adrenalin-2020. 2020 design software tutorial, office suite programs for mac office network software new software 2020 list. easy office software free download microsoft office software key, kundli software astrology 2020 horoscope.

    Reply
  5. pharmacie issy les moulineaux pharmacie aeroport bordeaux merignac medicine naltrexone 50 mg , pharmacie beaulieu et couillard therapies breves principes et outils pratiques pdf . pharmacie queliverzan brest act therapy jordan peterson , pharmacie leclerc quimper act therapy or cbt pharmacie de garde aujourd’hui thionville therapie cognitivo-comportementale saint etienne . pharmacie bailly romainvilliers pharmacie beaulieu nantes fax , medicaments ipp pharmacie cuisset amiens . pharmacie de garde yonne aujourd’hui pharmacie de service bourges , pharmacie de garde marseille rue de rome pharmacie leclerc quevert pharmacie de garde marseille grand littoral pharmacie auchan olivet . pharmacie aix en provence horaires therapies comportementales et cognitives formation , pharmacie angers belle beille pharmacie beauvais sur matha . pharmacie du soleil boulogne billancourt act therapy explained , pharmacie la bailly amiens therapie louise guay pharmacie fontcouverte avignon pharmacie lafayette zenith .

    Reply

Leave a Comment