猿问

redux dispatch是异步的吗?

redux dispatch是异步的吗


HUWWW
浏览 1614回答 1
1回答

桃花长相依

可能是你的action没有connect到组件上,没有把这个方法传过来。&nbsp;参考我写的一个方案&nbsp;<pre t="code" l="js">@connect(state =; state,dispatch =; bindActionCreators(action, dispatch))&nbsp;2.根据redux文档的方案<pre t="code" l="js">// 哪些 action 创建函数是我们想要通过 props 获取的看function mapDispatchToProps(dispatch) {return {onIncrement: () =; dispatch(increment())};}export default connect(mapDispatchToProps)(Counter);
随时随地看视频慕课网APP
我要回答