0

I have some vanilla html and js that interacts with DOM directly as below;

document.getElementsByClassName("sidebar")[0].insertAdjacentHTML('afterend',"<div id='test' class='testWindow'> </div>");

I understand that with react I should not manipulate the DOM directly, what is the equivalent of the above in react?

This window is added after a button press for context.

CHEESE
  • 15
  • 2
  • A state value which shows/hides an element in the render function. (I'm sure there are dozens of duplicate questions for this, so posting this as a comment) – DBS Mar 20 '23 at 09:44

0 Answers0