this is my action, I straight away dispatch an object in getMsgList
export function getMsgList(){
dispatch=>{
axios.get('/user/getmsglist')
.then(res=>{
if(res.state===200 && res.data.code===0){
dispatch({type:MSG_LIST, payload:res.data.data})
}
})
}
}
but I've seen some people create a function instead, they'll do it like this.
...
dispatch(getMsg(res.data.data)
...
getMsg(msg){
return{type:MSG_LIST,payload:msg}
}
What is the purpose of that 'extra function'?