Answer the question
In order to leave comments, you need to log in
Is it possible to rewrite the saga in thunk?
There is one component that triggers the action.
There is a second component that must perform some actions in response to an action from the first component.
Previously, this behavior was implemented on sagas:
import { takeLatest, call, put } from 'redux-saga/effects';
import { uploader as FileUploader } from './index';
import { CHANGE_FILE_NAME_ACTION } from './ActionTypes';
function* clearFileInput() {
try {
const { methods } = FileUploader;
yield call([methods, 'clearStoredFiles']);
yield put(CHANGE_FILE_NAME_ACTION({ name: '' }));
}
catch (err) {
console.log(err);
}
}
export default function* clearFileInputSaga() {
yield takeLatest('LIST_REFRESH', clearFileInput);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question