ReactJS confusing 'JS code as text' and real JS code: Add javascript code as text in ReactJS div -


i have react js component, in want enter sample js code text inside div.

code looks of sort

render: function() { return (     <div id="sample_code_text">        <p>          if( 1==1 ) {                               console.log(50) ;          }        </p>     </div> )}; 

i error @ console.log(50);

 uncaught error: parse error: line 37: unexpected token ; 

react's div confuses 'code text' js code. how fix this?

i think looking suggested @dev-null.
try this:

    <p>       if( 1==1 ) {'{'}         console.log(50) ;       {'}'}     </p> 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -