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
  • React, Inferno and Preact Packages
  • Redux Packages
  1. Usage

Installation

PreviousGetting StartedNextConnecting To React

Last updated 6 years ago

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:

refract-callbag

refract-inferno-callbag

refract-preact-callbag

refract-redux-callbag

refract-most

refract-inferno-most

refract-preact-most

refract-redux-most

refract-rxjs

refract-inferno-rxjs

refract-preact-rxjs

refract-redux-rxjs

refract-xstream

refract-inferno-xstream

refract-preact-xstream

refract-redux-xstream

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: .

    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!)

Configuring your store
React
Inferno
Preact
Redux
Callbag
Most
RxJS
xstream