Skip to content

Commit 3016455

Browse files
committed
Change and use es6 syntax
1 parent cc67717 commit 3016455

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
8-
"watch": "watchify -t [ babelify --presets [ react ] ] ./src/index.js -o ./build/bundle.js"
8+
"watch": "watchify -t [ babelify --presets [ react es2015 ] ] ./src/index.js -o ./build/bundle.js"
99
},
1010
"repository": {
1111
"type": "git",
@@ -22,12 +22,13 @@
2222
},
2323
"homepage": "https://github.com/MontpellierJS/react-intro#readme",
2424
"dependencies": {
25-
"babel-preset-react": "^6.3.13",
26-
"babelify": "^7.2.0",
2725
"react": "^0.14.6",
2826
"react-dom": "^0.14.6"
2927
},
3028
"devDependencies": {
29+
"babel-preset-es2015": "^6.3.13",
30+
"babel-preset-react": "^6.3.13",
31+
"babelify": "^7.2.0",
3132
"watchify": "^3.7.0"
3233
}
3334
}

src/components/TodoApp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
var React = require('react');
1+
import React from 'react'
22

3-
function TodoApp(props) {
3+
export function TodoApp(props) {
44
return (
55
<div className="todoApp">
66
Todo : Build The App

src/index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
var React = require('react');
2-
var ReactDOM = require('react-dom');
1+
import React from 'react'
2+
import { render } from 'react-dom'
3+
import TodoApp from './components/TodoApp'
34

4-
var TodoApp = require('./components/TodoApp.js');
5-
6-
ReactDOM.render(
7-
<TodoApp/>,
8-
document.getElementById('app')
9-
);
5+
render((<TodoApp/>),document.getElementById('app'))

0 commit comments

Comments
 (0)