<p dir="auto">I have some prolem when i render script tag.<br>
Example when i click link on page A, i new render page B which i inluce demo.js file. In demo.js i console.log('Hello world'). But when i open google devtools i don't see that. What happen which that erros.</p>
<p dir="auto"><code class="notranslate">&amp;lt;script&gt;</code> is a bit hard to use right now.</p>
<ul dir="auto">
<li>If you have a <code class="notranslate">{...}</code> then it's going to start interpolating. And you are bound to have whenever you use <code class="notranslate">if</code>, <code class="notranslate">function</code> ... Workaround: you can wrap it inside of an interpolated string <code class="notranslate">{'if (true) { ... }'}</code></li>
<li>If you have any <code class="notranslate">'</code> or <code class="notranslate">"</code> it's going to output the html encoded version and Javascript is going to throw a parsing exception.</li>
</ul>
<p dir="auto">In order to workaround those two issues the best way I found is to use dangerouslySetInnerHTML and use ES6 backtick in order to have multi-line strings.</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;script dangerouslySetInnerHTML={{__html: `
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  ga('send', 'pageview');
`}} /&gt;"><pre class="notranslate"><span class="pl-c1">&lt;</span><span class="pl-ent">script</span> <span class="pl-c1">dangerouslySetInnerHTML</span><span class="pl-c1">=</span><span class="pl-kos">{</span><span class="pl-kos">{</span><span class="pl-c1">__html</span>: <span class="pl-s">`</span>
<span class="pl-s">  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){</span>
<span class="pl-s">  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),</span>
<span class="pl-s">  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)</span>
<span class="pl-s">  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');</span>
<span class="pl-s">  ga('send', 'pageview');</span>
<span class="pl-s">`</span><span class="pl-kos">}</span><span class="pl-kos">}</span> <span class="pl-c1">/</span><span class="pl-c1">&gt;</span></pre></div>
<p dir="auto">We should probably make it easier, it's quite a pain to use right now.</p>