React Observatory
  • Introduction
  • Motivation
  • Dynamic Injection
    • Reducers
    • Epics
  • API Reference
    • applyAsyncEpics
    • applyAsyncReducers
    • composeReducerCreator
    • createRootEpic
    • injectEpic
    • injectReducer
    • withAction
    • withRouterAction
Powered by GitBook
On this page
  • Arguments
  • Returns
  • Example: Configuring the Store for dynamic Reducer injection
  1. API Reference

applyAsyncReducers

PreviousapplyAsyncEpicsNextcomposeReducerCreator

Last updated 6 years ago

A function that takes a reducer creator, created with returns a for dynamic Reducer injection.

Arguments

  1. reducerCreator (Function): A function that accepts an object with reducers and

Returns

(Function): A store enhancer that is used as an argument for to enable dynamic Reducer injection.

Example: Configuring the Store for dynamic Reducer injection

import { createStore } from 'redux'
import { applyAsyncReducers } from '@react-observatory/inject-reducer'
import reducerCreator from './reducers'

export default function configureStore(initialState = {}) {
  const store = createStore(
    reducerCreator(),
    initialState,
    applyAsyncReducers(reducerCreator)
  )

  return store
}
composeReducerCreator
store enhancer.
createStore.