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

Modifying the TasksList component

Finally, we will edit TasksList so that it does the following:

  • Dispatches the getListOfTasksAndIndex action during the componentWillMount life cycle event
  • Passes in the currentIndex of the state tree to the TextInput'sonSubmitEditing callback as a second argument

Call getListOfTasksAndIndex during componentWillMount, making sure that TasksList has the most up-to-date version of the listOftasks array as the user opens the app:

// TasksRedux/app/components/TasksList/index.js 

... 
export default class TasksList extends Component { 
  ... 
  componentWillMount () { 
    this.props.getListOfTasksAndIndex(); 
  } 

Add this.props.currentIndex as the second argument to calling the addTask method, so that we explicitly give each ...

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