T
TanStack3y ago
xenial-black

url to image?

How to best transform a URL from db to render an image? This it failing on my column definition. Do I need to add the transform differently?
{
accessorKey: 'avatar',
footer: (info) => info.column.id,
header: () => 'Avatar',
Cell: ({ row }) => <Avatar src={row.original.avatar} width="w-10" />,
},
{
accessorKey: 'avatar',
footer: (info) => info.column.id,
header: () => 'Avatar',
Cell: ({ row }) => <Avatar src={row.original.avatar} width="w-10" />,
},
1 Reply
xenial-black
xenial-blackOP3y ago
OK adding this worked
cell: (info) => flexRender(Avatar, { src: info.row.original.avatar, width: 'w-8' })
But now all will crash if NO Url is provided. How to handle empty cells?

Did you find this page helpful?