A
A
Alexander2021-05-17 17:57:29
redux
Alexander, 2021-05-17 17:57:29

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);
}


But now the sagas are no longer supported on the project, and it was decided to rewrite them all.
Is it possible to implement such logic on a sled?

I have the biggest problem with the action subscription, I don't understand how to do it.
In sagas, this is easily done with `take, takeLatest`, etc.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question