redux-saga / redux-saga-beginner-tutorial

Redux/Redux-saga beginner tutorial
MIT License
587 stars 544 forks source link

```utils.js:240 uncaught at check runSaga(storeInterface, saga, ...args): saga argument must be a Generator function! log @ utils.js:240 check @ utils.js:44 runSaga @ runSaga.js:31 2../Counter @ main.js:18 o @ _prelude.js:1 r @ _prelude.js:1 (anonymous) @ _prelude.js:1 utils.js:45 Uncaught Error: runSaga(storeInterface, saga, ...args): saga argument must be a Generator function! at check (utils.js:45) at runSaga (runSaga.js:31) at Object.2../Counter (main.js:18) at o (_prelude.js:1) at r (_prelude.js:1) at _prelude.js:1 check @ utils.js:45 runSaga @ runSaga.js:31 2../Counter @ main.js:18 o @ _prelude.js:1 r @ _prelude.js:1 (anonymous) @ _prelude.js:1``` #57

Open sareek opened 5 years ago

sareek commented 5 years ago

Error while trying to run 2 sagas at a time

sareek commented 5 years ago

SOLVED!

The issue was with default keyword on the documentation in saga. While starting more than one Sagas at a time in documentation it is written as,

export default function* rootSaga() {......

It should be,

export function* rootSaga() {

srbala commented 5 years ago

@sareek Please update edit subject/title line of this issue to more meaningful text

srbala commented 5 years ago

@sareek since you have solved the problem, Please close this issue. if you can fix the title that would be great.

pabloabreu1986 commented 5 years ago

SOLUTION! *As you export function as default in sagas.js as follows;

export default function* rootSaga() {
  yield all([
    helloSaga(),
    watchIncrementAsync()
  ])
}

*You should change the import statement in main.js from: import { rootSaga } from './sagas'; to: import rootSaga from './sagas';