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
Post a Comment