I trying to work with react. I have the next code :
index.js
var Btn = require('./components/Btn.jsx');
var app = {
// Application Constructor
initialize: function() {
console.log("here with me");
ReactDOM.render(<Btn>, document.getElementbyId('app'))
},
onDeviceReady: function() {
this.receivedEvent('deviceready');
},
};
app.initialize();
I have the next node_modules instaled:
- Babel
- Babel-plugin-transform-react-jsx
- Babel-preset-env
- Babel-cli
- babel-preset-env
- babel-preset-es2017
- babel-preset-react
Mi .babelrc
{ "presets": ["env"] }
When I run the comand for whath and compile the jsx to js I have the next
$ babel --presets env js/src --watch --out-dir js/dist
SyntaxError: js/src/index.js: Unexpected token (10:24)
8 | initialize: function() {
9 | console.log("here with me");
> 10 | ReactDOM.render(<Btn/>, document.getElementbyId('app'))
| ^
11 | },
12 |
13 | onDeviceReady: function() {
I really find about this and try a lot of things but i don't undestand what happen, in each tutorial that i see the sintax is correct and all works good. I hope that this can be something stupid and I can't found it. Can Anyone explain to me What can i do? or how.
"plugins": [ ["transform-react-jsx"] ]