您必须在异步请求结束后分派。
这将工作:
export function bindComments(postId) { return function(dispatch) { return API.fetchComments(postId).then(comments => { // dispatch dispatch({ type: BIND_COMMENTS, comments, postId }); }); };}
您必须在异步请求结束后分派。
这将工作:
export function bindComments(postId) { return function(dispatch) { return API.fetchComments(postId).then(comments => { // dispatch dispatch({ type: BIND_COMMENTS, comments, postId }); }); };}