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:
| ||||
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.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.
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
oryarn
):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 modified 4yr ago