Reactjs 从React组件的componentDidMount向Redux中的thunk发送多个调度的正确方式是什么?

Reactjs 从React组件的componentDidMount向Redux中的thunk发送多个调度的正确方式是什么?,reactjs,redux,react-redux,thunk,Reactjs,Redux,React Redux,Thunk,正如标题所示,我试图从同一组件的componentDidMounthook分派多个操作 MovieDetails.js class MovieDetails扩展组件{ componentDidMount(){ const movieId=this.props.movieId this.props.dispatch(fetchMovieDetails(movieId)) this.props.dispatch(fetchMovieImages(movieId)) 这个.props.dispatch

正如标题所示,我试图从同一组件的
componentDidMount
hook分派多个操作

MovieDetails.js

class MovieDetails扩展组件{
componentDidMount(){
const movieId=this.props.movieId
this.props.dispatch(fetchMovieDetails(movieId))
this.props.dispatch(fetchMovieImages(movieId))
这个.props.dispatch(fetchMovieActors(movieId))
}
所有的动作都很相似,下面是一个例子

export const fetchMovieActors=movieId=>{
const movieActorsUrl=`https://api.themoviedb.org/3/${movieId}/475557/credits?api_key=${apiKey}`
返回异步调度=>{
分派({type:“获取电影演员开始”})
试一试{
const res=wait axios.get(movieactorurl)
console.log(res)
派遣({
键入:“获取电影、演员、成功”,
数据:{movieActors:res.data}
})
}捕捉(错误){
派遣({
类型:“获取电影演员失败”,
错误:{error:“出现了问题”}
})
}
}
}

我只是想问,这是正确的做法吗?

你能详细说明一下吗?