我在拯救一个实体。
我希望触发一个同步savePending (针对存储触发一个减法器),然后触发一个异步save操作(进行网络调用以进行保存)。
function * saveEntity({ paylpoad: { id, name } }) {
yield put (savePending()); // triggers a synchronous reducer
yield put (save()); // triggers an async saga
yield put (saveComplete());
}
将等待savePending完成(即。在转到save之前,还原
我试图在我的反应项目中使用redux-saga,但是redux-saga函数没有被调用。toggleLoginModal操作在access.actions.js中被调用,但是toggleLoginModal在access.sagas.js中没有被调用。
Header.jsx
import React, { Component } from 'react';
import { withRouter } from 'react-router';
import accessActions from 'actions/access.actions';
i
我正在使用redux-saga的项目工作,我有一个问题要问你。我几乎花了两天的时间试图用谷歌的力量来寻找我的问题的答案,但没有任何帮助。
我们有一些函数是由saga在每个FETCH_REQUEST操作上触发的。
export function* fetchData(action) {
try {
const usersList = (yield select()).usersList;
// makes API call only if there is no users found in the current state
if(!usersList) {
我有一个简单的React / Redux / Redux应用程序,它使用API显示狗在单击按钮时的随机图片。
dogSagas.js
import { put, call, takeEvery, all } from 'redux-saga/effects';
import * as types from '../actions/types';
import * as actions from '../actions/dogActions';
import { DOG_API } from '../constants/variables&
技术使用: React,Redux,Saga如何在第二次函数调用后立即访问数据?firstFunction继续执行其余的代码。我尝试了async/await,但不起作用。
firstFunction (()=>{
secondFunctionAPI() //using Redux and Saga
// Here I want to use the data from the response of secondFunction().
more code...
more code..
})