How to add multiple middlewares to Redux?

Technology CommunityCategory: ReduxHow to add multiple middlewares to Redux?
VietMX Staff asked 3 years ago

You can use applyMiddleware where you can pass each piece of middleware as a new argument. So you just need to pass each piece of middleware you’d like. For example, you can add Redux Thunk and logger middlewares as an argument as below,

import { createStore, applyMiddleware } from 'redux'
const createStoreWithMiddleware = applyMiddleware(ReduxThunk, logger)(createStore);