import * as types from '../constants/ActionTypes';
export function addTodo(text) {
return { type: types.ADD_TODO, text }
}
export function deleteTodo(id) {
return { type: types.DELETE_TODO, id }
}
export function editTodo(id, text) {
return { type: types.EDIT_TODO, id, text }
}
export function completeTodo(id) {
return { type: types.COMPLETE_TODO, id }
}
export function completeAll() {
return { type: types.COMPLETE_ALL }
}
export function clearCompleted() {
return { type: types.CLEAR_COMPLETED }
}
这里面的 * 是什么用途,在后续的代码中没看到有用到*的地方。
楼主问得是*什么作用吧!这个就是全部的意思~我们写css的时候也会用到啊!就是把被加载模块整体引入的意思
constants/ActionTypes:
import * as types from '../constants/ActionTypes';
types 就是
针对你给出的代码就是
ECMAScript6 import语法,参考模块整体加载
翻译一下好了:
import (引入) * (所有export属性) as (到) types (types变量) from (从) '../constants/ActionTypes' (ActionTypes)