How to make a tooltip for a column in a table if the text in the column is larger than 250 pixels
I am using tailwind and shadcn for development.
My idea is that if the text in a column is larger than a certain number of pixels, it should be possible to see a tooltip from the shadcn library for the inscription in that cell, and if it is smaller, then without a tooltip.
I have a half-working solution, but it does not display ellipses if the text goes beyond the table cell (although the className is “truncate max-w-[250px]”)
And the main problem is that useEffect works after the component is rendered, so when I add the first long component, the tooltip is not visible for it until the next render, as soon as I add another element to the table, the tooltip becomes available for the previous one, but not for the new one