redux dispatch是異步的嗎
1 回答

桃花長相依
TA貢獻(xiàn)1860條經(jīng)驗(yàn) 獲得超8個贊
可能是你的action沒有connect到組件上,沒有把這個方法傳過來。
參考我寫的一個方案
<pre t="code" l="js">
@connect(
state =; state,
dispatch =; bindActionCreators(action, dispatch)
)
2.根據(jù)redux文檔的方案
<pre t="code" l="js">
// 哪些 action 創(chuàng)建函數(shù)是我們想要通過 props 獲取的看
function mapDispatchToProps(dispatch) {
return {
onIncrement: () =; dispatch(increment())
};
}
export default connect(
mapDispatchToProps
)(Counter);
- 1 回答
- 0 關(guān)注
- 1638 瀏覽
添加回答
舉報
0/150
提交
取消