How to get innerHTML of element React at the ref?

There is an element for example
<div ref="{el" = this.testelement="el" } style="{{...}}"><h1>xxx</h1></div>

how to convert this.TestElement, so I can use innerHTML in strigova form?
That is, I need to get the DOM element in a Thong
June 14th 19 at 20:25
1 answer
June 14th 19 at 20:27
const testElementHtml = this.TestElement.parentNode.innerHTML

But in this case will be the HTML of all child elements of the parent node
If in addition div'and then there are child elements, like this:
const testElementClone = this.TestElement.cloneNode(true)
const wrap = document.createElement('div')
const testElementHtml = wrap.innerHTML
Thank you so much, just don parentNode, a just innerHTML. Stupid "little" :) - Demarcus.Lehner commented on June 14th 19 at 20:30
why not parentNode? You need to convert TestElement in html or only its child elements? - matt_Bahringer commented on June 14th 19 at 20:33
but, parentNode still need :) - Demarcus.Lehner commented on June 14th 19 at 20:36
Yes , right, thank you - Demarcus.Lehner commented on June 14th 19 at 20:39

Find more questions by tags ReactJavaScript