Sign in Go Pro

React Native with Redux

Refactoring Action Creators and Action Types

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next



Actions are usually returned from functions called action creators. You can define actions inline, but they are usually extracted to separate files, and are returned from functions defined in those action files.

We'll take the add todo action which we were defining inline, and define it in an action creator instead. Then, we'll extract the action types to their own file.

Extracting action types isn't a necessary step, but it does provide protection from duplicate action names, as well as protection from circular dependencies.

Summary of Content:

  • Create a new actions folder to hold action creators
  • Create a new action creator which returns the ADD_TODO action
  • Create a new types file, and extract the ADD_TODO constant to that file




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


Lessons in React Native with Redux