File tree Expand file tree Collapse file tree 4 files changed +3
-6
lines changed Expand file tree Collapse file tree 4 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -25,4 +25,5 @@ function mapStateToProps(state) {
2525 }
2626}
2727
28+ //将state的指定值映射在props上,将action的所有方法映射在props上
2829export default connect ( mapStateToProps , action ) ( App ) ;
Original file line number Diff line number Diff line change 1- //定义
1+ //定义一个change方法,将来把它绑定到props上
22export function change ( value ) {
33 return {
44 type :"change" ,
Original file line number Diff line number Diff line change 1+ //reducer就是个function,名字随便你起,功能就是在action触发后,返回一个新的state(就是个对象)
12export default function change ( state , action ) {
23 if ( action . type == "change" ) return { value :action . value } ;
34 return { value :'default' } ;
Original file line number Diff line number Diff 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} ;
You can’t perform that action at this time.
0 commit comments