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

84
Views
cómo hacer efectos de alternar individuales en los botones hechos con un mapa de matriz

Estoy usando reaccionar con firebase Los datos almacenados en firebase se importan a useEffect, luego se agrega el estado de la lista de configuración y se genera div como un mapa. ¿Qué debo hacer cuando quiero dar un evento de alternar individual para cada botón creado con el mapa?

Cuando el evento de alternar se vuelve verdadero, si la edición es falsa, quiero generar el componente de agregar.

mi código

 let [list, SetList] = useState([]); let [toggle,setToggle] = useState(false); useEffect(() => { db.collection("title").onSnapshot((snapshot) => { let titleArray = snapshot.docs.map((doc) => ({ ...doc.data(), })); SetList(titleArray); }); }, []); list.map(function(value,index){ <button type="button" onclick={(e)=>{ props.dispatch({type:"open"}}>click</button> toggle === true ? <Edit/> //component : <add/> //component })

Cuando presiono el primer botón, quiero cambiar solo el primer botón de falso a verdadero y mantener el resto de los botones falsos.

about 4 years ago · Juan Pablo Isaza
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!