私は佐賀の構造について考えてきましたが、それは正しいかどうかわかりません。Reduxのためのよりよい構造は何ですか?
たとえば、私は複数のサガファイルを持っていますが、それぞれの典型的なサガファイルに対して、1つのウォッチャーサガは異なるアクションを同時に監視し、デフォルトでこのウォッチャーサガをエクスポートする必要があります。ここで
は私の暫定的なアプローチである:
私はわからABOTないです道のIグループウォッチャーの冒険談
/**
* saga.js
*
* one watcher saga watch multiple actions concurrently
* However, from my research, I can only see that everyone seems to create
* multiple watcher sagas, and each watcher only watch single action which is
* sort of verbose
*/
function* watchSomething() {
yield all([
takeLatest(GET_SOMETHING, callGetSomething),
takeLatest(GET_SOMETHING_2, callGetSomething_2),
takeLatest(GET_SOMETHING_3, callGetSomething_3),
]);
}
export default watchSomething;
そして
/**
* rootSaga.js
*
* import different watcher sagas from different saga.js files
*/
export default function* root() {
yield all([
watchSomething(),
watchSomething_2(), // the others ...
]);
};