concept redux in category react native

appears as: Redux
React Native in Action

This is an excerpt from Manning's book React Native in Action.

You also need to keep up with the data and state throughout the routes and possibly access methods defined elsewhere in the app, so having a strategy around data and method sharing is important. You can manage data and methods either at the top level, where the navigation is defined, or using a state-management library such as Redux or MobX. In the example, you’ll manage data and methods in the class at the top level of the app.

8.1 What is Redux?

In the Redux documentation, the library is described as “a predictable state container for JavaScript apps.” Redux is basically a global state object that’s the single source of truth in an application. This global state object is received as props into React Native components. Any time a piece of data is changed in the Redux state, the entire application receives this new data as props.

Listing 8.3 Creating a root reducer
import { combineReducers } from 'redux'    #1  
import bookReducer from './bookReducer'    #2  

const rootReducer = combineReducers({    #3  
  bookReducer
})

export default rootReducer

#1   Imports the combineReducers function from Redux
#2   Imports the bookReducer reducer
#3   Creates a root reducer containing all the reducers; in this case it contains the single property bookReducer