Sign in Go Pro

React Native with Redux

Add a Loading Indicator Based on Redux State

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson
Autoplay

Up next

Previous

About

We removed the loading indicator from the list because it was pulling from local state, but now we can convert that to Redux. Redux thunk allows us to dispatch multiple actions from the same thunk, so we can dispatch new actions that will tell the reducer to turn a loading indicator on and off.

Summary of Content:

  • Create and dispatch two new actions: todosLoading, and todosLoaded
  • Change the todos reducer to change a loading boolean based on those actions
  • Use the todos.loading flag to turn the loading spinner on and off
  • Add a Refresh button to the TodoList component that calls the loadTodos method, and reloads the todo items

Instructor

Links

Comments

There are no comments on this lesson, start the conversation below ...

>
You need to go PRO to post comments.

Lessons in React Native with Redux