I copy+paste the code from : https://stackoverflow.com/questions/41514549/
Then, I fix error and change 'class' by 'id' so:
main.html
<head>
<title>React Meteor Voting</title>
</head>
<body>
<div id="render-target"></div>
</body>
main.jsx
import React, { Component } from 'react';
import {Meteor} from 'meteor/meteor';
import { render } from 'react-dom';
Meteor.startup(() => {
render(<App />, document.getElementById('render-target'));
});
class App extends Component {
render(){
return (
<h1>Hello!</h1>
);
}
}
package.json
{
"name": "test-react",
"private": true,
"scripts": {
"start": "meteor run"
},
"dependencies": {
"babel-runtime": "^6.20.0",
"meteor-node-stubs": "~0.2.4",
"react": "^15.5.4",
"react-dom": "^15.5.4"
}
}
But I got the same error:
Uncaught Error: _registerComponent(...): Target container is not a DOM element. at invariant (modules.js?hash=de726ed…:12672) at Object._renderNewRootComponent (modules.js?hash=de726ed…:30752) at Object._renderSubtreeIntoContainer (modules.js?hash=de726ed…:30842) at render (modules.js?hash=de726ed…:30863) at app.js?hash=71ef103…:46 at maybeReady (meteor.js?hash=27829e9…:809) at HTMLDocument.loadingCompleted (meteor.js?hash=27829e9…:821)
Is driving me crazy.... ¡¡¡¡¡