Skip to content

react-table row onClick #2295

May 11, 2020 · 8 comments · 20 replies
Discussion options

You must be logged in to vote

You can use onClick on tr. Here's an example (search for onClick):

import * as React from "react";
import { useTable } from "react-table";

type Data = {
  actor: string;
  movie: string;
}

const borderStyle = {
  border: "1px dashed navy"
};

export default function App() {
  const origData = [
    {
      actor: "Johnny Depp",
      movies: [
        {
          name: "Pirates of the Carribean 1"
        },
        {
          name: "Pirates of the Carribean 2"
        },
        {
          name: "Pirates of the Carribean 3"
        },
        {
          name: "Pirates of the Carribean 4"
        }
      ]
    }
  ];
  const newData: Array<Data> = [];
  origData.forEach(actorObj => {

Replies: 8 comments 20 replies

Comment options

You must be logged in to vote
12 replies
@SethuSS
Comment options

@abdulsamadayoade
Comment options

@sultanov2103
Comment options

@Nik-Ark
Comment options

@adarshSrivastava01
Comment options

Answer selected by sonalk215
Comment options

You must be logged in to vote
2 replies
@sonalk215
Comment options

@vikrant-gembrill
Comment options

Comment options

You must be logged in to vote
1 reply
@deadcoder0904
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@sonalk215
Comment options

Comment options

You must be logged in to vote
3 replies
@davewasthere
Comment options

@isomorpheric
Comment options

@nani1008
Comment options

Comment options

You must be logged in to vote
1 reply
@MichaelGreco
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment