GithubHelp home page GithubHelp logo

Comments (3)

davulrich avatar davulrich commented on June 19, 2024 2

The function run before the element is rendered to the DOM.
You need to wait on window event "DOMContentLoaded."

Example:

import ReactDOM from 'react-dom'
import App from './app

window.addEventListener('DOMContentLoaded', () => {
  const rotateqDivElements = document.querySelectorAll('.rotateq-calc')
  rotateqDivElements.forEach((element) => {
    ReactDOM.render(<App />, element)
  })
})

@LearnWebCode Could you confirm it and change it in your code please?

from brads-boilerplate-wordpress.

aczire avatar aczire commented on June 19, 2024 1

@Geraldf @davulrich's observation is correct. You need to wait for the DOM to load all the elements.
I tried loading the script in the footer, by enabling in_footer parameter.
wp_enqueue_script('boilerplateFrontendScript', plugin_dir_url(__FILE__) . 'build/frontend.js', array('wp-element'), "0.0.1", true); which also worked.

from brads-boilerplate-wordpress.

Imonin avatar Imonin commented on June 19, 2024

Any solution to the block being empty?

from brads-boilerplate-wordpress.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.