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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -