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

Setting up our store

To set up our store, we will need to use Redux's createStore method and then pass it a reducer. Here's how it looks on a high level:

let store = createStore(task) 

Additionally, since we know we'll be dealing with asynchronous calls in our application, we should also set up Redux-Thunk to support it.

To do so, pass the applyMiddleware function as the second argument to createStore. Pass thunk as an argument for applyMiddleware:

let store = createStore(listOfTasks, applyMiddleware(thunk)); 

Finally, we'll export a stateless function that returns our app container wrapped around the Provider:

export default function Tasks (props) { 
  return ( 
    <Provider store={ store }> 
      <AppContainer /> 
    </Provider> 
  ) 
} 

In total, here's ...

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