首页 > ...state 这个语法怎么用browserify 转换

...state 这个语法怎么用browserify 转换

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 


【热门文章】
【热门文章】