createRootEpic

A helper for creating a root epic and a stream of epics that enables adding new Epics asynchronously.

Arguments

  1. epic (Epic): 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 and rootEpic, which is required for creating a redux-observable middleware.

Example: Creating a Root Epic

./src/epics

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 }

Last updated