0

Using NodeJS to build an web app, I am using React and Pug together. I know that Pug is for rendering static content, and React is responsible for rendering dynamic content. I have a page that needs both.

Think about the Instagram web page, it has some static content, but when user scroll down to the bottom, it will load more pictures.

I have a Pug template, which in the end, I included the React script like this:

block scripts
    script(src="/component/design-grid.js" type="module") 

And I want to trigger my react code by doing(This won't work):

script ReactDOM.render(<DesignGrid mainPage={true} category={"daily"} verified={false}/>, document.getElementById("grid-container"));

What's the standard way to accomplish something like this?

chrisTina
  • 2,298
  • 9
  • 40
  • 74
  • Why doesn't it work? What is the output you are getting? – Graham Mar 23 '20 at 01:37
  • 2
    Does this answer your question? [How can I render inline JavaScript with Jade / Pug?](https://stackoverflow.com/questions/5858218/how-can-i-render-inline-javascript-with-jade-pug) – Graham Mar 23 '20 at 01:37

0 Answers0