Let's modify our region application so that it will connect to the backend service.
First of all, to use redux-thunk, we will have to install the package:
npm install redux-thunk --save
Then, we must modify the store to use the new middleware. (We'll be seeing more middleware later in this chapter, and in the next one as well.) This change is very small, as the following code shows:
// Source file: src/regionsApp/store.js
/* @flow */
import { createStore, applyMiddleware } from "redux";
import thunk from "redux-thunk";
import { reducer } from "./worlds.reducer.js";
export const store = createStore(reducer, applyMiddleware(thunk));