Skip to content

Commit 3929a6c

Browse files
author
lewis617
committed
zhushi
1 parent 4e20322 commit 3929a6c

File tree

4 files changed

+3
-6
lines changed

4 files changed

+3
-6
lines changed

input-redux/src/App.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ function mapStateToProps(state) {
2525
}
2626
}
2727

28+
//将state的指定值映射在props上,将action的所有方法映射在props上
2829
export default connect(mapStateToProps,action)(App);

input-redux/src/actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//定义
1+
//定义一个change方法,将来把它绑定到props上
22
export function change(value){
33
return{
44
type:"change",

input-redux/src/reducers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//reducer就是个function,名字随便你起,功能就是在action触发后,返回一个新的state(就是个对象)
12
export default function change(state,action){
23
if(action.type=="change")return{value:action.value};
34
return {value:'default'};

input-redux/webpack.config.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ module.exports = {
2323
]
2424
},
2525
plugins: [
26-
// kills the compilation upon an error.
27-
// this keeps the outputed bundle **always** valid
28-
new webpack.NoErrorsPlugin(),
29-
//这个使用uglifyJs压缩你的js代码
30-
//new webpack.optimize.UglifyJsPlugin({minimize: true}),
3126
new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js')
3227
]
3328
};

0 commit comments

Comments
 (0)