Installation

Refract is available for a number of reactive programming libraries. For each library, a Refract integration is available for React, Inferno, Preact and Redux.

Available packages:

The examples below assume you're using RxJS - if you're using a different library, use the table above to find the correct package names.

React, Inferno and Preact Packages

The React, Inferno and Preact packages don't require much set up - you just need to install the package (usually via npm or yarn):

npm install --save refract-rxjs

The same applies to Inferno and Preact packages.

Redux Packages

The Redux packages involve an extra step to apply the Refract enhancer to your Redux store:

  1. Install the latest stable version (again usually via npm or yarn):

    npm install --save refract-redux-rxjs
  2. Import the Refract store enhancer and apply it to your redux store. This process is explained in detail in the Redux documentation: Configuring your store.

    For example:

    import { compose, createStore } from 'redux'
    import { refractEnhancer } from 'refract-redux-rxjs'
    
    import reducers from './store'
    
    const store = createStore(reducers, {}, refractEnhancer())
    
    export default store

    (Note that this example is unrealistically simple!)

Last updated