My entry file with Redux Saga generally looks like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import {all} from "redux-saga/effects";
import {
watchLoginRequest,
watchLogoutRequest,
watchCurrentUserRequest,
watchUpdateProfileRequest
} from "./authSaga";
import {
watchGetUserList,
watchGetUser,
watchAddUser,
watchUpdateUser,
watchDeleteUser
} from "./adminSaga";
export default function* rootSaga() {
yield all([
watchLoginRequest(),
watchLogoutRequest(),
watchCurrentUserRequest(),
watchUpdateProfileRequest(),
watchGetUserList(),
watchGetUser(),
watchAddUser(),
watchUpdateUser(),
watchDeleteUser(),
]);
}
As you can see a set of imports and then an array of functions added to the generator function used in my store module. This works fine, but I often find that swapping between a specific sagas file and the rootSagas file to be an unnecessary step prone to error.
Read more