Redux-saga 有条件地获取最新信息

问题描述我有一个关于redux-saga的问题,有什么方法可以实现takeLatest但有条件.Ihaveaquestionrelatedtoredux-sagathatisthereanywaytoachievetakeLatestbutwithcondition.例如,我有一

发布:2022-10-16 标签:javascriptreactjsreact-reduxredux-saga


即使其中一个承诺被拒绝,也不要让整个任务失败

问题描述在reduxsaga中,如果我们想处理多个promise,可以使用all(相当于Promise.all):Inreduxsagaifwewanttohandlemultiplepromises,wecanuseall(whichisequivalentofPromise.

发布:2022-10-16 标签:javascriptreactjspromisereact-reduxredux-saga


redux saga 选择器,如何从 saga 访问状态?

问题描述之前有人问过类似的问题,但答案对我没有任何帮助.Similarquestionshavebeenaskedbefore,buttheanswershavenotbeenofanyhelptome.redux中的选择器是什么?如何获得来自redux-saga函数内的stat

发布:2022-10-16 标签:reactjsreact-reduxredux-saga


什么时候应该使用 Redux Saga 而不是 Redux Thunk,什么时候应该使用 Redux Thunk 而不是 Redux Saga?

问题描述这个问题与过去不同,这就是为什么.这个问题是什么时候.由于两者本身都是很好的框架,因此问题是我什么时候应该使用thunk而不是saga.因为我的一个朋友一直坚持要我在我们的应用程序中使用saga但没有明显的原因.先谢谢了Thequestionisdifferentfrom

发布:2022-10-16 标签:reactjsreact-reduxredux-thunkredux-saga


React/redux 应用程序在 Safari 上呈现空白屏幕

问题描述我在React/redux中构建了一个应用程序,它适用于我尝试过的所有浏览器,但适用于MacOS上的Safari和iPhone上的任何浏览器.我没有收到错误消息,没有控制台消息,也没有任何可以给我一些想法的东西.它只在Safari中呈现标签并且屏幕是空白的.Ibuilta

发布:2022-10-16 标签:javascriptreactjsreduxredux-saga


如何使用 Redux Saga 测试 API 请求失败?

问题描述我正在尝试测试我的传奇可能遵循的每个场景,但我无法实现我想要的行为.这很简单,我有一个HTTP请求(登录),我想通过模拟我的API方法来测试成功和失败的情况.Iamtryingtotesteveryscenariosmysagacouldfollow,butiamnota

发布:2022-10-16 标签:javascriptgeneratorreactjsreduxredux-saga


如何从 redux-saga 函数中的 state/store 获取一些东西?

问题描述如何在saga函数中访问redux状态?HowdoIaccessthereduxstateinsideasagafunction?简答:import{select}from'redux-saga/effects';...letdata=yieldselect(stateS

发布:2022-10-16 标签:javascriptreactjsreduxreact-reduxredux-saga


如何使用 Redux-Saga 处理 fetch() 响应中的错误?

问题描述我尝试使用redux-saga处理来自服务器的Unauthorized错误.这是我的传奇:ItrytohandleUnauthorizederrorfromserverusingredux-saga.Thisismysaga:function*logIn(action){

发布:2022-10-16 标签:javascriptfetchreduxredux-saga


反应钩子:从 useEffect 分派动作

问题描述我的文件夹结构:|--App|--Components|--PageA.js|--PageB.js|--PageC.js|--common-effects|--useFetching.js我正在重构我的代码以使用reacthooks从API获取数据.我想从useFetch

发布:2022-10-16 标签:javascriptreactjsreduxredux-saga


使用带有 ES6 生成器的 redux-saga 与带有 ES2017 async/await 的 redux-thunk 的优缺点

问题描述现在有很多关于redux镇最新的孩子的讨论,redux-saga/redux传奇.它使用生成器函数来监听/调度动作.在我考虑它之前,我想知道使用redux-saga而不是下面使用redux-thunk的方法的优缺点代码>带有异步/等待.一个组件可能看起来像这样,像往常一样

发布:2022-10-16 标签:javascriptreactjsreduxredux-thunkredux-saga