# compose

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](/glossary.md#store-enhancer) in a row.

## Arguments

1. (*arguments*): The functions to compose. Each function is expected to accept a single parameter. Its return value will be provided as an argument to the function standing to the left, and so on. The exception is the right-most argument which can accept multiple parameters, as it will provide the signature for the resulting composed function.

## Returns

(*Function*): The final function obtained by composing the given functions from right to left.

## Example

This example demonstrates how to use `compose` to enhance a [store](/api-reference/store.md) with [`applyMiddleware`](/api-reference/applymiddleware.md) and a few developer tools from the [redux-devtools](https://github.com/reduxjs/redux-devtools) package.

```javascript
import { createStore, applyMiddleware, compose } from 'redux'
import thunk from 'redux-thunk'
import DevTools from './containers/DevTools'
import reducer from '../reducers'

const store = createStore(
  reducer,
  compose(
    applyMiddleware(thunk),
    DevTools.instrument()
  )
)
```

## Tips

* All `compose` does is let you write deeply nested function transformations without the rightward drift of the code. Don't give it too much credit!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://redux-ru.js.org/api-reference/compose.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
