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

135
Views
cómo convertir esto en un mecanografiado

Cómo hacer este jsx en mecanografiado. En javascript, se ve así. ¡Pero en mecanografiado, no sé cómo lograr este código exacto!

 const Users = ({details,deleteUser}) => { return ( <> <div> {details.map(detail => ( <tr key={detail.del}> <td>{detail.del}</td> <td>{detail.name}</td> <td>{detail.email}</td> <td>{detail.pass}</td> <td>{detail.contact}</td> <td className='delete-btn' onClick={() => deleteUser(detail.del)}> Delete </td> </tr> ))} </div> </> )}
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Como primero, debe definir su tipo de accesorios:

 type User = { del: string; name: string; email: string; pass: string; contact: string; }; type UsersProps = { details: User[]; deleteUser: (del: string) => void; };

Después de esto, debe aplicar el tipo a los accesorios del componente:

 const Users = (props: UsersProps) => { const {details,deleteUser} = props; return ( <> <div> {details.map(detail => ( <tr key={detail.del}> <td>{detail.del}</td> <td>{detail.name}</td> <td>{detail.email}</td> <td>{detail.pass}</td> <td>{detail.contact}</td> <td className='delete-btn' onClick={() => deleteUser(detail.del)}> Delete </td> </tr> ))} </div> </> ) };

De esta manera, TypeScript le mostrará cualquier error tipográfico, por ejemplo, si escribe detail.mail en lugar de detail.email , ts lo resaltará.

about 4 years ago · Juan Pablo Isaza Report

0

Al principio, necesita la interfaz del Usuario en mecanografiado.

 export default interface IUser { id: number, name: string, image: string, ...others }

Luego, debe definir los parámetros pasados, debería verse como la interfaz de usuario. Así será el código.

 {details<IUser[]>.map(detail => ( <tr key={detail.del}> <td>{detail.del}</td> <td>{detail.name}</td> <td>{detail.email}</td> <td>{detail.pass}</td> <td>{detail.contact}</td> </tr> ))}
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!