Sign in Go Pro

React Native with Redux

Pulling Items from an API into Redux

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next



The app already pulls items from the HTTP API server, but they are currently just being put in local state. We'll convert that local state to Redux by dispatching a setTodos action with the result of that HTTP call.

Summary of Content:

  • Create a new setTodos action, which sets the todo items in the todos reducer
  • Use the setTodos action to pass all the new items to the reducer
  • Modify the todos reducer to set the todos to the new list of todos from the server




Your instructions here were:
To import the new action, just like you did for addItem.
And then make sure to add it to the 2nd argument of connect, otherwise it won't work properly.
And it can sometimes be tricky to figure out the error.

Great. Okay. Understood.

Now fast forward 4 days, and I am trying to do this on my own (4 days after watching this video)
I then wasted 3 hours, yes, 3 freakin hours, with it not working, and what did I find as a solution 3 long, tiring hours later?
Yup, I had forgotten to add it to the dang 2nd argument of connect !!

GAH! Yeah I HATE problems like that..... not sure I have any advice other than "log a bunch of stuff and see what isn't connected right..." sorry! Hopefully it won't bite you next time :)


Lessons in React Native with Redux