Root Saga

Hands-on practice for this lecture. Write the code, see it run, understand the pattern.

1

Exercise 1 of 1

Root Saga -- Quiz

Four questions on root saga fundamentals: why function* is required, what the no-yield warning means, whether the startup order is correct, and the root saga vs worker saga split.

Four questions testing root saga fundamentals: why it must be a generator function, what the empty-saga warning means, whether the startup order is correct, and what role the root saga plays.

function vs function*

// Option A
export function rootSaga() {
  console.log('running');
}

// Option B
export function* rootSaga() {
  console.log('running');
}

1Which option is valid for saga.run(rootSaga)?

Empty Root Saga

export function* rootSaga() {
  console.log('root saga invoked');
}

2Redux Saga shows a warning after this runs. What is the warning about?

Startup Order

const saga = createSagaMiddleware();

const store = createStore(reducers, applyMiddleware(saga));

saga.run(rootSaga);  // called here

export default store;

3Is the placement of saga.run() correct here?

Root Saga Purpose

4What is the root saga responsible for in a production Saga setup?

0/4 answered

Practice: Root Saga — Interactive Exercises | Durgesh Rai