Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

112
Views
passing data when click dropdown button

I'm using React and I'm making a lotery app and my app uses an RestAPI to load data every saturday.

I have a dropdown with differents dates and I want to pass the date when you clicked the button, but I don't know how to passed date like a parameter when you click it

Dropdown picture

<div className="btn-group">
 <div className="dropdown">
   <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" 
   data-bs-display="static" aria-expanded="false">
    Sorteos Anteriores
   </button>
    <ul className="dropdown-menu" aria-labelledby="dropdownMenuLink">
          {PrevDraws.map((index, i) => (
        <li> 
          <button obj={index} key={i} className="dropdown-item" type="button">       
            {PrevDraws[i]}
          </button>
        </li>
      ))}
    </ul>
  </div>
</div>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can call your function in onClick

 <button obj={index} key={i} className="dropdown-item" type="button" 
 onClick={()=>{console.log(PrevDraws[i])}} >       

 {PrevDraws[i]}

 </button>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!