const helloReducer = (state: Immut = initialState, action: { type: string, payload: any }) => { switch (action.type) { case SAY_HELLO: return state.set('message', action.payload) default: return state }}(state: Immut = initialState, action: { type: string, payload: any }) 这个参数是什么写法?解构也不长这个样子啊?跪求答案?
1 回答

慕斯709654
TA贡献1840条经验 获得超5个赞
这是typescript或者flow的语法
写成js的话就是这样
const helloReducer = (state = initialState, action) => { /*...*/ }
冒号后面指定的类型是用于编译期检查参数类型的
添加回答
举报
0/150
提交
取消