score:1

Accepted answer
const Parent = () => {

   const [selectedID, setSelectedID] = useState(null)

   return (
      // ...
      <Row onSelectRow={setSelectedID} selectedID={selectedID} />
      <Row onSelectRow={setSelectedID} selectedID={selectedID} />
      <Row onSelectRow={setSelectedID} selectedID={selectedID} />
      <Row onSelectRow={setSelectedID} selectedID={selectedID} />
      // ...
   )
}

const Row = (props) => {
   const {setSelectedID, selectedID} = props
   return (
      <TableRow
        onClick={() => {
          setSelectedID(row.id);
        }}
        selected={selectedID === row.id}
      >
      //...
      </TableRow>
   )

Related Query

More Query from same tag