长期使用Redux-Saga值得吗?
Redux-Saga是Redux副作用经理,据说被弃用,不再维护。
然而,不管大约3年前出版了最后1.1.3版的Redux-Saga版本,超过100万开发人员每周下载此NPM包装。
如果我继续长期使用Redux-Saga,即使它不再由作者维护,我可能会面临什么问题?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我是Redux维护者。
今天,我们在几乎所有用例中都特别推荐使用Sagas使用Sagas
!如果您确实需要该功能,那么拥有该工具很重要。但是大多数时候,您每天都不需要电锯。
实际上,我只是就这个特定主题进行了讨论:
Reactathon 2022:redux async逻辑的演变
在那段演讲中,我描述了在Redux应用中处理异步逻辑和副作用的不同技术,并为您今天使用的内容提供了一套建议。我将粘贴到这里的最后一个幻灯片中供参考:
我们今天的建议
您要解决什么用案例?
数据获取
createAsyncthunk
对操作/状态变化做出反应,异步工作流
通过State Access
getState
并派遣多个操作I'm a Redux maintainer.
Today, we specifically recommend against using sagas in almost all use cases!
To be clear: Sagas are a great power tool, like a chainsaw. If you really need that power, then having that tool is important. But most of the time, you don't need a chainsaw on a daily basis.
I actually just gave a talk on this specific topic:
Reactathon 2022: The Evolution of Redux Async Logic
In that talk I described different techniques for dealing with async logic and side effects in Redux apps, and gave our set of recommendations for what you should use today. I'll paste in the last slide here for reference:
Our Recommendations Today
What use case are you trying to solve?
Data Fetching
createAsyncThunk
Reacting to Actions / State Changes, Async Workflows
Logic with State Access
getState
and dispatching multiple actions