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

88
Views
REACCIONAR- Rellene la casilla de verificación si el valor = 1 de lo contrario no se llena

¿Cómo puedo crear una casilla de verificación que se llene cuando item.availability=1 (por ejemplo) elif 0 no está lleno? Puedo devolver {item.availability} en la función Checkbox pero quiero algo más genérico.

 export default function Display() { ... function Checkbox({ value }) { const [checked, setChecked] = React.useState(true); return ( <label> <input type="checkbox" defaultChecked={checked} onChange={() => setChecked(!checked)} /> {value} </label> ); } return ( <> .... {"Availability "} <Checkbox ({item[0].availability})/> </div> </div> </> ); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Simplemente puede establecer el apoyo de valor recibido como estado inicial del estado marcado . Luego haga el accesorio marcado en el elemento de entrada según el estado:

 function Checkbox({ value }) { const [checked, setChecked] = React.useState(value); return ( <label> <input type="checkbox" checked={checked} onChange={() => setChecked(checked => !checked)} /> {value} </label> ); }

Asegúrate de pasar el accesorio correctamente:

 <Checkbox value={!!item.availability} />
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!