Im using the datagrid component here
I would like to use html in one of the fields and show a link or a picture etc. I tried using the render function for the column as below
var columns = [
{ name = 'field' },
{ name = 'link',render : function(uri) { return '<a href="'+uri+'">link</a>'} },
];
however it prints out the html as text
This is because by default React escapes HTML, in order to prevent XSS attacks. You can by pass this, by using the
prop
dangerouslySetInnerHTML
, as described here.However, as the name suggests, this leads to a vulnerability. I would suggest instead to use Mardown, especially the marked package.
You can write a general component like this one and then use it everywhere.
In your case then