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

236
Views
React Carbon DataTable no obtiene el evento onclick (valor) para el seleccionado

Solo estoy explorando reaccionar con carbono y me quedé atascado con algún evento desencadenante. Aquí está mi pieza de código (ChildComponent)

 <DataTable rows={rows} headers={headers} size='tall' zebra> {({ rows, headers, getTableProps, getHeaderProps, getRowProps }) => ( <Table {...getTableProps()}> <TableHead> <TableRow> {headers.map((header, i) => ( <TableHeader key={i} {...getHeaderProps({ header })}> <React.Fragment>{header.header}</React.Fragment> </TableHeader> ))} </TableRow> </TableHead> <TableBody> {rows.map((row, j) => ( <div key={row.id}> <TableRow key={row.package} {...getRowProps({ row })}> <> {row.cells.map((cell) => ( <> <TableCell key={cell.id}>{cell.value}</TableCell> </> ))} <Button color='primary' id={row.package} onClick={this.props.redirectToDesigner(row.package)}> Open </Button> </> </TableRow> <br /> </div> ))} </TableBody> </Table> )} </DataTable>

Esto se encuentra en el componente secundario y el componente principal se ve a continuación

 import React from "react"; import ChildComponent from "./ChildComponent"; class ParentComponent extends React.Component { redirectToDesigner = (id) => { alert(1); console.log("TRYYYY", id); }; render() { return <ChildComponent redirectToDesigner={this.redirectToDesigner} />; } } export default ParentComponent;

Recibo la alerta y la consola como indefinida por alguna razón

Aquí puede ver un evento onclick, se activa pero no obtengo valor (row.id) de él. Necesito el valor para un mayor desarrollo.

Cualquier ayuda / violín será muy útil

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!