node.js - How to use an ejs variable inside a react render function? -


i'm passing variable abcd index.ejs in turn calls react js file render index.ejs page. i've been able access <%= abcd %> inside index.ejs not inside render function of react. can me out?

thanks

i faced same problem index.html file, filled react component, , resolved this:

in index.html

<script>     window.abcd = '<%- abcd %>'; </script> 

in react component

render: function(){     return(        <div>             <p> {window.abcd} </p>        </div>     ); } 

this worked me, if has cleaner proposition, i'm in!


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -