add Link to a react-table cell

react-table add edit/delete column link

Try the below examples to achieve add edit/delete columns in react-table using Link,

As an Example,

Import the Link component,
import { Link } from 'react-router-dom'

If you want to add Edit link in React-Table Cell, Use below code,
const columns = [
    Header: 'Name',
    accessor: 'name',
    Cell: ({ row }) => (<Link to={{pathname:'/editpage/'+`${row.pageURL}`state :{data : row} } }>{}</Link>),
    filterable : true

If you want to add function/method after click on react-table cell button, Use below code,
const columns = [
     Header: '',
     Cell: row => (
             <button onClick={() => handleEdit(row)}>Edit</button>
             <button onClick={() => handleDelete(}>Delete</button>

Result looks like,


Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog -
My Books - Book 1 and Book 2 Powered by Blogger.