Refract
  • Read Me
  • Introduction
    • Why Refract?
    • Core Concepts
    • Thinking In Refract
    • Alternatives
  • Usage
    • Getting Started
    • Installation
    • Connecting To React
    • Observing React, Preact and Inferno
    • Injecting Dependencies
    • Observing Redux
    • Observing Anything
    • Handling Effects
    • Pushing to Props
    • Rendering Components
    • Handling Errors
    • Testing
  • Recipes
    • Dependency Injection
    • Creating An API Dependency
    • Handling state
    • Replacing Redux Connect
  • Examples
    • Debounced fetch
    • Counter
    • Field validation
    • Redux fetch
    • Routing
    • Typeahead
    • Visit time
  • API
    • compose
    • withEffects
    • toProps, asProps
    • useRefract
    • refractEnhancer (Redux)
  • Glossary
  • Feedback
Powered by GitBook
On this page
  • Packages
  • Signature
  • Arguments
  • Returns
  • Example
  1. API

refractEnhancer (Redux)

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

Packages

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

Signature

refractEnhancer = (options?) => {
    return StoreCreator
}

Arguments

  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
          }
      }

Returns

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.

Example

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
}
PrevioususeRefractNextGlossary

Last updated 6 years ago

Read more about configuring your Redux store here!