簡體   English   中英

有人可以解釋下面關於JS箭頭功能的示例

[英]Can someone explain below example on JS arrow function

下面的函數是“調度”,是參數還是其他。 如果有人可以描述其背后的理論,將會很有幫助。 以及下面的傳統書寫方式。

export const incrementCount = () => dispatch => {
    return dispatch({ type: actionTypes.INCREMENT })
};

在上面的代碼中, incrementCount是一個函數,該函數返回一個接受dispatch作為參數的函數,並且返回的函數正在返回dispatch方法

export const incrementCount () {
  return function(dispatch) {
      return dispatch({ type: actionTypes.INCREMENT })
   }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM