title: How can I get the plain text from the render method from React component or convert a JSX.Element to string?
body: <p>I want to get the plain text of a render method <strong>without rendering it into DOM</strong>:</p>
  
  <pre><code>class Test from React.Component {
  
      getPlainText = () =&gt; {
          const plainText = /* some method */(this.renderParagraph())
          console.log(plainText) // output in console: &lt;p&gt;I'm text from props of Text component!&lt;/p&gt;
      }
  
      renderParagraph () {
         return &lt;p&gt;{this.props.text}&lt;/p&gt;
      }
  
      render () {
          return &lt;button onClick={this.getPlainText}&gt;click me will print {this.props.text} in console&lt;/button&gt;
      }
  }
  </code></pre>
  
  <p>I didn't find a possible React or ReactDom API to accomplish this requirement.</p>