Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor React render component to div inside main html file

I'm not really sure what is happening when the component tries to find the div, but here is my render and my div.

HTML:

<div id="app"></div>

Render function:

Meteor.startup(() => { ReactDOM.render(<App />, document.getElementById('app')); });

I get this error in the console: Error: Target container is not a DOM element.

I also put a console.log after my render function trying to find the div id but returned = null.

like image 405
Taylor Gagne Avatar asked Aug 24 '26 18:08

Taylor Gagne


1 Answers

What packages have you got installed?

if you've still got blaze-html-templates or templating, remove them both and replace with static-html

Otherwise Meteor will render the html as a blaze template some time after startup. (Also if you're using React, you probably don't want to ship Blaze to the client as well!)

like image 109
coagmano Avatar answered Aug 26 '26 07:08

coagmano



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!