Comments (3)
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.
@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.
Any solution to the block being empty?
from brads-boilerplate-wordpress.
Related Issues (16)
- lg and other breakpoints don't work in tailwind plugin with blocks
- React is in seems to be in production build while developing theme
- Tailwind changes dont work HOT 1
- Npm Packages
- Issue Adding More Than One Plugin HOT 1
- Why useEffect in EditComponent?
- Updating to WP 6.4 breaks fse-hybrid-theme placeholder blocks HOT 1
- Make it into a plug in
- Not working in production
- Where to put image files referenced in index.php HOT 2
- run command deletes files from build folder
- frontend work doesn't work HOT 2
- Could I use tailwind with block template?
- localhost:3000 wont work HOT 1
- This one is done only for 1-block plugin HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brads-boilerplate-wordpress.