I have 2 column of text dynamically rendered in nextJS. I want to set the max-height of the second column depending on the height of the first one.
I tried doing this, but it doesn't work. The problem seems to come form passing the variable as value, because if I replace descriptionHeight by 100px for exemple it works.
const descriptionHeight = document.getElementById('desc').offsetHeight;
const generic = document.getElementById('generic');
if (descriptionHeight <= generic.offsetHeight) {
generic.style.maxHeight = descriptionHeight;
}
I first tried to pass the offsetHeight value with inline style, inside the jsx, but I get an error for variable not defined