【发布时间】:2020-06-26 17:22:14
【问题描述】:
我对那个 redux thunk 操作感到困惑:
import axios from 'axios';
export const GET_CHANNELS = 'GET_CHANNELS'
export const getChannels = () => async (dispatch, getState) => {
const res = await axios.get('https://v-forum-api.bahdcasts.com/api/channels')
dispatch({
type: GET_CHANNELS,
payload: res.data
})
}
以下构造是什么意思?
const getChannels=()=>async()=>{}
您能否提供该表达式的任何文章链接? 谢谢
【问题讨论】:
-
这是一个返回函数的函数(本例中为异步)。阅读 redux-thunk 文档。
-
这能回答你的问题吗? Syntax for async arrow function
标签: ecmascript-6 redux redux-thunk