Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

257
Vistas
change backgroundColor of the clicked row react-data-table-component

I've built a table with react-data-table-component that shows the user data. When I click a row on the right side a component is shown where we can see more info about the user. I want to change the background color of the clicked row and persist that until another row is clicked. How can I achieve it with react-data-table-component? I've already tried it with conditionRowStyles provided by the package but the style changes for every row. I want to change the bg of only the row I clicked Package I'm using: https://www.npmjs.com/package/react-data-table-component

const Table = () => {
  const onRowClick = (row, event) => {
    setSelectedCandidateId(row.user_id);
  };

  return (
    <DataTable
      title={title}
      columns={columns}
      data={candidates}
      selectableRows
      highlightOnHover
      onRowClicked={onRowClick}
      pointerOnHover
      keyField={"candidate_id"}
      paginationDefaultPage={currentPage}
      onSelectedRowsChange={onRowSelect}
      pagination
      paginationServer
      paginationTotalRows={totalRecords}
      onChangeRowsPerPage={handlePerRowsChange}
      onChangePage={handlePageChange}
      selectableRowsHighlight
      striped
    />
  );
};
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda