为了账号安全,请及时绑定邮箱和手机立即绑定

帮忙看下这个函数参数是怎么传的,这是啥写法。

帮忙看下这个函数参数是怎么传的,这是啥写法。

杨魅力 2018-11-08 14:11:52
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) => {   
 /*...*/
 }

冒号后面指定的类型是用于编译期检查参数类型的


查看完整回答
反对 回复 2018-12-05
  • 1 回答
  • 0 关注
  • 410 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号