const todos = ( state = [], action ) => {
switch ( action.type ) {
case 'ADD_TODO':
return [
...state,
todo( undefined, action )
];
case 'TOGGLE_TODO':
return state.map( t => todo( t, action ) );
default:
return state;
}
};
browserify app.js
提示
...state,
^
ParseError: Unexpected token
browserify -t es6-spread app.js
提示
throw e;
^
Error: Line 39: Spread must be the final element of an element list
at throwError