Created
June 30, 2020 11:20
-
-
Save alexmochu/fba6bf47c24ff793a7aadd0b8b09cbac to your computer and use it in GitHub Desktop.
Create Sagas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { all, call, delay, put, takeEvery } from 'redux-saga/effects' | |
export function* incrementAsync() { | |
yield delay(1000) | |
yield put({type: 'INCREMENT'}) | |
} | |
export function* watchIncrementAsync() { | |
yield takeEvery('INCREMENT_ASYNC', incrementAsync) | |
} | |
// single entry point to start all Sagas at once | |
export default function* rootSaga() { | |
yield all([ | |
call(watchIncrementAsync), | |
]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment