I am new to reactjs and trying to learn saga.
I have built a root saga file as follows.
import { all } from 'redux-saga/effects';
import { watchBookFetchRequest } from './bookSaga'
import { watchAuthRequest, watchIsLoggedInRequest, watchLogoutRequest } from './authSaga'
export default function* rootSaga() {
yield all([
watchAuthRequest(),
watchBookFetchRequest(),
watchIsLoggedInRequest(),
watchLogoutRequest()
]);
}
For each module, i have created a separate saga file and put all those related actions in that file.
Finally, i took all those actions and combined them in root saga.
I assume, when the project becomes big and more complex and has a lot of modules, all the watchers will be added in the same way like the above code
export default function* rootSaga() {
yield all([
watchRequest1(),
watchRequest2()
.
.
.
watchRequestn()
]);
}
That is, the root saga will be containing quite a lot of watchers - Watchers for login, dashboard, books, accounts and so on..
Is this the correct way of doing this?
all
in therootSaga