使用 redux-saga 和 react-router [英] Using redux-saga with react-router
本文介绍了使用 redux-saga 和 react-router的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个关于react-router的问题:例如,我想在成功调用创建api(使用redux-saga)后从创建表单重定向到编辑表单.在这种情况下我应该如何使用 react-router?
I have a question about react-router: for example, I want to redirect from Create form to Edit form after called to create api (using redux-saga) successfully. How should I use react-router in this case?
推荐答案
如果您还包括 react-router-redux 您可以简单地将页面更改视为另一个从 saga 调用的 redux 操作(使用新的 push
API).
If you include also react-router-redux you can simply treat the page change as another redux action to call from saga (using the new push
API).
有点像……
yield put(push('your/route'))
这篇关于使用 redux-saga 和 react-router的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文