Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display html link inside table cell using reactjs material-table

I am using material-table of Reactjs npm package, I want display a link with url inside table cells. but it is displaying it as string. Any idea how to display link

data: [
      {
        subject: 'Announcment',
        type: 1,
        approver: 'john',
        state: 1,
        view: "<Link to="/users">cell</Link>",
      },
    ]
like image 556
muthukumar murugesan Avatar asked May 21 '26 19:05

muthukumar murugesan


1 Answers

Yes Here is the solution.

columns: [
      { 
        title: 'Analytics', 
        field: 'analytics', 
        render: rowData => <Link to="/{rowData.url}">view</Link>,,
      },
    ],

and 


data: [
      {
        subject: 'Announcment',
        type: 1,
        approver: 'john',
        state: 1,
        url: "/users",
      },
like image 147
muthukumar murugesan Avatar answered May 23 '26 13:05

muthukumar murugesan