Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

258
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda