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

253
Views
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
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!