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

Single state tree

In Redux, rather than having each component manage its own state, we deal with one single-state tree that contains all the logic in our application. For example, for the Tasks app we built in the first two chapters, you can visualize it as follows:

{ 
  cellExpanded: false, 
  tasks: [ 
    { 
      title: 'Buy Milk', 
      completed: false, 
      dueDate: undefined 
    }, 
    { 
      title: 'Walk Dog', 
      completed: true, 
      dueDate: undefined 
    } 
  ], 
} 

This helps make our app a lot easier to debug, since we're only dealing with one object tree when looking at the information it contains.

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