> For the complete documentation index, see [llms.txt](https://react-observatory.js.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://react-observatory.js.org/api-reference/createrootepic.md).

# createRootEpic

A helper for creating a root epic and a stream of epics that enables [adding new Epics asynchronously.](https://redux-observable.js.org/docs/recipes/AddingNewEpicsAsynchronously.html)

### Arguments

1. `epic` ([`Epic`](https://redux-observable.js.org/docs/basics/Epics.html)): takes your root epic and decorates it to support Dynamic Epic Injection.

### Returns

(`Object`): An object with a reference to `epic$` stream of all epics, witch is used by [applyAsyncEpics](/api-reference/applyasyncepics.md) and `rootEpic`, which is required for [creating a redux-observable middleware.](https://redux-observable.js.org/docs/basics/SettingUpTheMiddleware.html)

### Example: Creating a Root Epic

## `./src/epics`

```javascript
import { createRootEpic } from '@react-observatory/inject-reducer'

const logger = action$ =>
  action$
    .ofType('Up')
    .do(console.log)
    .ignoreElements()

const { epic$, rootEpic } = createRootEpic(logger)

export { epic$, rootEpic }
```
