Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8537430

Browse files
committedAug 3, 2017
init
0 parents  commit 8537430

File tree

13 files changed

+3257
-0
lines changed

13 files changed

+3257
-0
lines changed
 

‎.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["latest", "stage-0", "react"]
3+
}

‎.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
/**/.DS_Store
3+
npm-debug.log

‎README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# HelloJS React Basic Practice
2+
3+
How to run:
4+
```
5+
npm install
6+
npm start
7+
```
8+
and go to [http://localhost:3000](http://localhost:3000)
9+
10+
環境需求:Node.js 6.10 以上

‎index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<title>AlphaCamp React Basic Demo</title>
6+
<meta charset="UTF-8">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
</head>
9+
10+
<body>
11+
<div id="root"></div>
12+
</body>
13+
<script src="/dist/bundle.js"></script>
14+
15+
</html>

‎package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"scripts": {
3+
"start": "node server.js"
4+
},
5+
"dependencies": {
6+
"babel-core": "^6.24.1",
7+
"babel-loader": "^6.4.1",
8+
"babel-polyfill": "^6.23.0",
9+
"babel-preset-latest": "^6.24.1",
10+
"babel-preset-react": "^6.24.1",
11+
"babel-preset-stage-0": "^6.24.1",
12+
"express": "^4.15.2",
13+
"react": "^15.5.4",
14+
"react-dom": "^15.5.4",
15+
"webpack": "^2.4.1",
16+
"webpack-dev-middleware": "^1.10.1",
17+
"webpack-notifier": "^1.5.0"
18+
}
19+
}

‎root.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from 'react'
2+
import ReactDOM from 'react-dom'
3+
4+
import TodoApp from './src/TodoApp.jsx'
5+
6+
ReactDOM.render(<TodoApp/>, document.getElementById('root'));

‎server.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const express = require('express');
2+
const webpack = require('webpack');
3+
const webpackCompiler = webpack(require('./webpack.config.js'));
4+
const port = 3000;
5+
6+
const app = express();
7+
8+
app.use(require('webpack-dev-middleware')(webpackCompiler, {
9+
noInfo: true,
10+
publicPath: `http://localhost:${port}/dist`
11+
}));
12+
13+
app.use(express.static('.'));
14+
15+
app.listen(port, (err) => {
16+
if (err) {
17+
console.log(err);
18+
return;
19+
}
20+
console.log(`Server is listening at http://localhost:${port}`);
21+
});

‎src/TodoAddForm.jsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react'
2+
3+
class TodoAddForm extends React.Component {
4+
state = {
5+
inputText: ''
6+
}
7+
8+
render() {
9+
return (
10+
<div>
11+
<input type="text" value={this.state.inputText}/>
12+
<button>新增</button>
13+
</div>
14+
);
15+
}
16+
}
17+
18+
export default TodoAddForm;

‎src/TodoApp.jsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react'
2+
import TodoList from './TodoList.jsx'
3+
import TodoAddForm from './TodoAddForm.jsx'
4+
5+
class TodoApp extends React.Component {
6+
render() {
7+
return (
8+
<div>
9+
<h2>Todo App</h2>
10+
asdasasd
11+
</div>
12+
);
13+
}
14+
}
15+
16+
export default TodoApp;

‎src/TodoItem.jsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react'
2+
3+
class TodoItem extends React.Component {
4+
render() {
5+
return (
6+
<div>
7+
8+
</div>
9+
);
10+
}
11+
}
12+
13+
export default TodoItem;

‎src/TodoList.jsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react'
2+
import TodoItem from './TodoItem.jsx'
3+
4+
class TodoList extends React.Component {
5+
render() {
6+
return (
7+
<div>
8+
9+
</div>
10+
);
11+
}
12+
}
13+
14+
export default TodoList;

‎webpack.config.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const WebpackNotifierPlugin = require('webpack-notifier');
2+
3+
module.exports = {
4+
entry: [
5+
'babel-polyfill',
6+
'./root.js'
7+
],
8+
9+
output: {
10+
path: '/dist',
11+
filename: 'bundle.js',
12+
},
13+
14+
module: {
15+
rules: [{
16+
test: /\.(js|jsx)$/,
17+
loader: 'babel-loader',
18+
exclude: /node_modules/
19+
}]
20+
},
21+
22+
devtool: 'eval-source-map',
23+
24+
plugins: [
25+
new WebpackNotifierPlugin({
26+
alwaysNotify: true
27+
})
28+
]
29+
};

‎yarn.lock

Lines changed: 3090 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.