I have a requirement that need to update the style of the element based on dynamic content. Here i am setting ul element max height based on detail content.
if (element.innerText === this.res.viewMore) {
primaryButtonText = this.res.viewLess;
messageListElement.style.maxHeight = `${this.checkHeightOfList(
detail.split(','),
)}px`;
} else {
primaryButtonText = this.res.viewMore;
messageListElement.style.maxHeight = null;
}
What is the best practice to update the max height in react js ? Here is my DOM