1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Redux-saga備忘録

Posted at

#Redux-saga備忘録

##generator関数

functionの末尾に*をつける
redux-sagaはgenerator関数にyieldを記述することで処理を実装する

function* allNightNippon() {
  yield takeEvery(actions.Types.GET_USERS_REQUEST, getUsers);
}

##select
現在のstateから情報を取得する関数

const waka = yield select(state => state.keidash.owarai.audrey);

##put
引数に渡したactionをdispatchする関数

const waka = yield put({
 type: WAKABAYASI_NO_FAN,
 payload: {
  masayasu,
  toshiaki,
 }
});

##call
Promiseの完了を待つ


import wakatyan form './keydash/owarai/audrey';

const masayasu = yield call(callpost, wakatyan.run);

##fork
タスクの並列処理を行う


import wakatyan form './keydash/owarai/audrey';
yield fork(wakatyan.run);

##takeEvery
Actionがdispatchされるたびにredux-sagaのtaskを起動する関数
Actionのとりこぼし対策に使用


import wakatyan form './keydash/owarai/audrey';

function* allNightNippon() {
   yield fork(wakatyan.run);
}

yield takeEvery(ACTION, allNightNipponn);
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?