Handle Side Effects with Redux Saga Generator Functions

Share this video with your friends

Send Tweet

In this lesson we’ll fetch the star wars api and display the response to our UI. Saga effects and generators allow us to synchronously run asynchronous tasks.

PCR IT Training
PCR IT Training
~ 6 years ago

Anyone else having trouble with the import { call, put } from 'redux-saga/effects';? I found this https://github.com/brunch/brunch/issues/1695 whihc also has a similar issue linked in the thread. It seems that a workaround is import { call, put } from 'redux-saga/lib/effects';

tnl-matt
tnl-matt
~ 6 years ago

I had problems with npm install (npm v6.7.0) and ended up installing everything from scratch. In case this helps anyone, here's my resulting package.json. Also, the lecture appears to start with the master branch.

{
  "name": "sagas",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.0.0",
    "react-dom": "^16.7.0",
    "react-redux": "^6.0.0",
    "react-scripts": "^2.1.3",
    "redux": "^4.0.1",
    "redux-saga": "^1.0.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "devDependencies": {
    "redux-devtools": "^3.5.0"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}
Lauro Silva
Lauro Silva
~ 5 years ago

Further context of this application can be found in the source code and by exploring the different branches: https://github.com/twclark0/redux-sagas-gh/tree/simple-saga-example

Note, as Matt mentioned in the previous comment, install npm i npm@6.7.0.