Русский перевод Redux Saga
  • Главная страница
  • Содержание
    • Главная страница
    • 1. Введение
      • 1.1 Руководство для начинающих
      • 1.2 Предпосылки Saga
    • 2. Основные концепции
      • 2.1. Использование хелперов Saga
      • 2.2 Декларативные эффекты
      • 2.3 Отправка действий
      • 2.4 Обработка ошибок
      • 2.5 Распространёная абстрация: Эффект
    • 3. Продвинутые концепции
      • 3.1 Получение будущих действий
      • 3.2 Неблокирующие вызвы
      • 3.3 Выполнение задач параллельно
      • 3.4 Выполнение гонки между несколькими эффектами
      • 3.5 Последовательность Sagas с использованием yield*
      • 3.6 Композиция Sagas
      • 3.7 Отмена задач
      • 3.8 Модель форвка redux-saga
      • 3.9 Общие паттерны параллелизма
      • 3.10 Примеры тестирования Sagas
      • 3.11 Подключение Sagas к внешнему входу/выходу
      • 3.12 Использование каналов
      • 3.13 Шаблоны корневой саги
    • 4. Рецепты
    • 5. Внешние ресурсы
    • 6. Исправление проблем
    • 7. Глоссарий
    • 8. Справочник API
Powered by GitBook
On this page
  1. Содержание
  2. 2. Основные концепции

2.5 Распространёная абстрация: Эффект

To generalize, triggering Side Effects from inside a Saga is always done by yielding some declarative Effect. (You can also yield Promise directly, but this will make testing difficult as we saw in the first section.)

What a Saga does is actually compose all those Effects together to implement the desired control flow. The most basic example is to sequence yielded Effects by putting the yields one after another. You can also use the familiar control flow operators (if, while, for) to implement more sophisticated control flows.

We saw that using Effects like call and put, combined with high-level APIs like takeEvery allows us to achieve the same things as redux-thunk, but with the added benefit of easy testability.

But redux-saga provides another advantage over redux-thunk. In the Advanced section you'll encounter some more powerful Effects that let you express complex control flows while still allowing the same testability benefit.

Previous2.4 Обработка ошибокNext3. Продвинутые концепции

Last updated 6 years ago