Sign in Go Pro

React Native with Redux

Changing Data in Redux with Redux Actions

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson
Autoplay

Up next

Previous

About

Reducers are responsible for handling the actions that are dispatched. They take in the existing state and every action, and return a new state based on that action.

We'll add a switch/case statement in the todos reducer to handle the add todo action, which will return a new todos state.

It's important to note that reducers should not modify the state, but only return a new state object; so we'll use the object and array spread operators.

Links

Summary of Content:

  • Reducers handle actions that come in - usually with a switch/case statement
  • The state that comes into reducers is immutable, so we'll use the object spread operators to return a new state
  • Once the reducer returns a new state, the TodoList will automatically re-render, because the props change

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