阅读 redux todomvc 的代码时,为什么在以下代码中没有使用任何键值({})呢?例如以下代码中的 text
和 id
之前没有键值,让我有些困惑。
import * as types from '../constants/ActionTypes'
export const addTodo = text => ({ type: types.ADD_TODO, text })
export const deleteTodo = id => ({ type: types.DELETE_TODO, id })
export const editTodo = (id, text) => ({ type: types.EDIT_TODO, id, text })
export const completeTodo = id => ({ type: types.COMPLETE_TODO, id })
export const completeAll = () => ({ type: types.COMPLETE_ALL })
export const clearCompleted = () => ({ type: types.CLEAR_COMPLETED })
欢迎提出任何评论。谢谢。
更新
感谢您的答案和评论。我发现我的问题有点愚蠢。目前,我正在为了娱乐而学习react和redux。我不熟悉es2015。有时,我无法区分2015年新语法和redux语法。谢谢。
id
与id: id
相同。 - Ram