Skip to content

code under <script> is not working in ReactLiquid component #32

@yash-teachmint

Description

@yash-teachmint

JS is working perfectly in HTML template when I try it on LiquidJS playground. But it is not working with ReactLiquid in react.
Following is my code, please tell me where I am doing wrong

const template = `<html lang="en">
<body>
    <h1 data-id="hj">Hello</h1>
    <script>
    console.log('Here')
    document.querySelectorAll("[data-id='hj']")[0].innerHTML = 'World';
    </script>
    </body>
      </html>`

const RightPanel = ({data}) => {
  return (
    <div className={styles.container}>
      <div className={styles.pdfPage}>
        <ReactLiquid template={template} data={data} html />
      </div>
    </div>
  )
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions