Skip to content

Latest commit

 

History

History

09-apply-middleware

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Using combineReducers

This submodule contains simple Redux Bank application

  1. add redux library

    1. reducer (state, action, action.type, action.payload)

    2. store (createStore, subscribe, dispatch)

  2. add react-redux library:

    1. connect

  3. add redux-devtools

  4. connect many sub-components

  5. use combineReducers to group few reducers (implement filtering todoList by it’s done value)

  6. use applyMiddleware

applyMiddleware

let’s install redux-thunk

Terminal
yarn add -ED redux-thunk

before

store.js
import { createStore } from 'redux';
import combineReducers from './reducers';

export const store = createStore(
  combineReducers,
  // ...
);

after

store.js
import { createStore, applyMiddleware } from 'redux';
import combineReducers from './reducers';
import thunk from 'redux-thunk';

export const store = createStore(
  combineReducers,
  applyMiddleware(thiunk),
);

build, run, deploy

yarn start
yarn build
yarn deploy