Composes functions from right to left.
This is a functional programming utility, and is included in Redux as a convenience.
You might want to use it to apply several store enhancers in a row.
(Function): The final function obtained by composing the given functions from right to left.
This example demonstrates how to use compose
to enhance a store with applyMiddleware
and a few developer tools from the redux-devtools package.
import { createStore, combineReducers, applyMiddleware, compose } from 'redux' import thunk from 'redux-thunk' import DevTools from './containers/DevTools' import reducer from '../reducers/index' const store = createStore( reducer, compose( applyMiddleware(thunk), DevTools.instrument() ) )
compose
does is let you write deeply nested function transformations without the rightward drift of the code. Don't give it too much credit!
© 2015–2016 Dan Abramov
Licensed under the MIT License.
http://redux.js.org/docs/api/compose.html