title: ReactJs : How to extract SVG component text as a string
body: <p>I have a SVG component called CircleSVG.</p>
  <p>As of now I can get the SVG as a inline component and use directly inside the <strong>div</strong> .</p>
  <p>Later on, I want to extract the content of this component and store it as a string.</p>
  <p>Something like <code>const text = JSON.stringify(CircleSvg())</code> (even though this does not work).</p>
  <p>Thanks in advance.</p>
  <p><strong>CircleSvg.js</strong></p>
  <pre><code>import React from 'react';
  export default () =&gt;
      &lt;svg width=&quot;100&quot; height=&quot;100&quot;&gt;
          &lt;circle cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;40&quot; stroke=&quot;green&quot; stroke-width=&quot;4&quot; fill=&quot;yellow&quot; /&gt;
          Sorry, your browser does not support inline SVG.
      &lt;/svg&gt;
  </code></pre>
  <p><strong>App.js (Which is working fine)</strong></p>
  <pre><code>import React, {Component} from 'react';
  import CircleSvg from './CircleSvg';
  class App extends Component {
    render() {
      return (
        &lt;div&gt;
          &lt;CircleSvg/&gt;
        &lt;/div&gt;
      )
    }
  }
  export default (App)
  </code></pre>
  <p><strong>Want to extract the SVG text from the component</strong></p>