O'Reilly logo

React Native By Example by Richard Kho

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the TasksList container

Now that we've got our actions and reducers, we'll create the container that connects our dispatch methods and state to the TasksList component.

First, we'll import the connect module from react-redux, alongside any actions we intend to dispatch in TasksList, as well as the TasksList component itself:

// TasksRedux/app/containers/TasksListContainer/index.js 

import { connect } from 'react-redux'; 
 
import { 
  addTask, 
  changeCompletionStatus, 
  changeInputText, 
} from '../../actions'; 
 
import TasksList from '../../components/TasksList'; 
 

Then we'll create three methods that will result in dispatching functions to our state tree using mapDispatchToProps:

 const mapDispatchToProps = (dispatch) => { return { addTask: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required