refractEnhancer (Redux)

Used to enhance a Redux store, adding observable functionality which can be used inside Refract.


refractEnhancer is provided by our Redux packages - refract-redux-callbag, refract-redux-most, refract-redux-rxjs, and refract-redux-xstream.


refractEnhancer = (options?) => {
    return StoreCreator


  1. options (object): an object which configures the Refract store enhancer.

    Two options are currently available for the refractEnhancer:

    • eventsPrefix (string): defines an actionType prefix which marks actions which are not intended to be forwarded to your reducers. Refract will intercept these, preventing them from touching your state (or any downstream store enhancers), but will forward them on to any watching apertures. (default: @@event/)

    • methodName (string): customises the name used for the store.observe method. (default: observe)

      Note that customising the methodName option with TypeScript will break the Redux Store interface, which is extended when you import the Refract enhancer. To use this option with TypeScript, you will need to extend the interface - for example:

      import { StoreObserveFunction } from 'refract-redux-rxjs'
      declare module 'redux' {
          interface Store {
              observeWithRxjs: StoreObserveFunction


StoreCreator (Redux store creator): a function which creates a redux store. Note that you should not be calling this function directly, and instead should be passing it into Redux createStore.


import { createStore } from 'redux'
import { refractEnhancer } from 'refract-redux-rxjs'
import rootReducer from './reducers'

export default function configureStore() {
    const store = createStore(rootReducer, null, refractEnhancer())

    return store

Read more about configuring your Redux store here!

Last updated