Namespace

Store

Store

Methods

# static applyFlexMiddleware(argopt)

Applies Flex middleware to redux store
Parameters:
Name Type Attributes Description
arg History | HistoryType | HistoryParams <optional>
instance of History, type of a history (memory, browser) or parameters for getHistory() function
Examples
const myReduxStore = createStore(
 reducers,
 compose(
   applyFlexMiddleware()
 )
);
import createMemoryHistory from "history/createMemoryHistory";
const history = createMemoryHistory();
const myReduxStore = createStore(
 reducers,
 compose(
   applyFlexMiddleware(history)
 )
);

# static FlexReducer(state, action) → {AppState}

Flex reducer for Redux store. Use key `flex` in your redux store for Flex state.
Parameters:
Name Type Description
state AppState state of the application
action RouterReducer.RootAction dispatched action
Flex state
AppState
Example
import { FlexReducer, applyFlexMiddleware} from "@twilio/flex-ui";
const reducers = combineReducers({
  flex: FlexReducer,
  myApp: myAppReducer // application reducer
});
const myReduxStore = createStore(
  reducers,
  compose(
    applyFlexMiddleware()
  )
);

# static flexStoreEnhancer() → {Store.EnhancedStore}

Store enhancer which allows the user to add any additional reducers after the store has been created.
It returns enhanced store with an additional `addReducer` method.

Type Definitions

ReduxStore

# EnhancedStore

Properties:
Name Type Attributes Description
addReducer function <optional>
Function used to add reducer to an already created store.