All Projects → fanduel-oss → Refract

fanduel-oss / Refract

Licence: mit
Harness the power of reactive programming to supercharge your components

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Refract

Inferno Most Fp Demo
A demo for the ReactJS Tampa Bay meetup showing how to build a React+Redux-like architecture from scratch using Inferno, Most.js, reactive programmning, and various functional programming tools & techniques
Stars: ✭ 45 (-94.31%)
Mutual labels:  rxjs, reactive-programming, inferno
bassdrum
reactive, type safe components with preact and rxjs.
Stars: ✭ 44 (-94.44%)
Mutual labels:  rxjs, preact
reactive-angular-workshop
This is the source code for the world's greatest Reactive Angular Workshop.
Stars: ✭ 30 (-96.21%)
Mutual labels:  rxjs, reactive-programming
angular2-instagram
🔥Instagram like photo filter playground built with Angular2 (Web | Desktop)
Stars: ✭ 91 (-88.5%)
Mutual labels:  rxjs, reactive-programming
Nerv
A blazing fast React alternative, compatible with IE8 and React 16.
Stars: ✭ 5,409 (+583.82%)
Mutual labels:  preact, inferno
ng-observe
Angular reactivity streamlined...
Stars: ✭ 65 (-91.78%)
Mutual labels:  rxjs, reactive-programming
observe-component
A library for accessing React component events as reactive observables
Stars: ✭ 36 (-95.45%)
Mutual labels:  rxjs, reactive-programming
Beicon
Reactive Streams for ClojureScript
Stars: ✭ 133 (-83.19%)
Mutual labels:  rxjs, reactive-programming
Toy Rx
A tiny implementation of RxJS that actually works, for learning
Stars: ✭ 290 (-63.34%)
Mutual labels:  rxjs, reactive-programming
Awesome Rxjs
A collection of awesome RxJS resources
Stars: ✭ 314 (-60.3%)
Mutual labels:  rxjs, reactive-programming
Learn Rxjs
Clear examples, explanations, and resources for RxJS
Stars: ✭ 3,475 (+339.32%)
Mutual labels:  rxjs, reactive-programming
vuse-rx
Vue 3 + rxjs = ❤
Stars: ✭ 52 (-93.43%)
Mutual labels:  rxjs, reactive-programming
Awesome Reactive Programming
A repository for sharing all the resources available on Reactive Programming and Reactive Systems
Stars: ✭ 163 (-79.39%)
Mutual labels:  rxjs, reactive-programming
Nwb
A toolkit for React, Preact, Inferno & vanilla JS apps, React libraries and other npm modules for the web, with no configuration (until you need it)
Stars: ✭ 5,429 (+586.35%)
Mutual labels:  preact, inferno
Redux Most
Most.js based middleware for Redux. Handle async actions with monadic streams & reactive programming.
Stars: ✭ 137 (-82.68%)
Mutual labels:  rxjs, reactive-programming
rxjs-proxify
Turns a Stream of Objects into an Object of Streams
Stars: ✭ 34 (-95.7%)
Mutual labels:  rxjs, reactive-programming
Recycle
Convert functional/reactive object description using RxJS into React component
Stars: ✭ 374 (-52.72%)
Mutual labels:  rxjs, reactive-programming
Cyclejs.cn
The Cycle.js Chinese documentation website.
Stars: ✭ 132 (-83.31%)
Mutual labels:  rxjs, reactive-programming
Od Virtualscroll
🚀 Observable-based virtual scroll implementation in Angular
Stars: ✭ 133 (-83.19%)
Mutual labels:  rxjs, reactive-programming
observable-playground
Know your Observables before deploying to production
Stars: ✭ 96 (-87.86%)
Mutual labels:  rxjs, reactive-programming


Handle your component effects and side-effects in a clear and declarative fashion
by using asynchronous data streams (reactive programming).


Why? · Install · The Gist · Learn · Contribute · Discuss


Build MIT License Styled with Prettier


  • 🎳 Decentralised: attach effects and side-effects to your components, for better code splitting results
  • 🌅 Gradual: use on an existing component today, throughout your app tomorrow
  • 🚀 Reactive: leverage the power and benefits of reactive programming
  • 💾 Tiny: less than 2Kb minified and gzipped
  • Typed: written in TypeScript, fully typed integrations
  • Universal: supports React, React Native, Inferno and Preact

Refract makes reactive programming possible in React, React Native, Preact and Inferno, with only a single higher-order component or a single hook! You can choose to start using a tiny bit of reactive programming, or go full reactive. Refract allows you to:

We also provide a Redux integration, which can serve as a template for integrations with other libraries. With a single HoC, you can fully replace libraries like recompose, redux-observable, and react-redux to name a few!

Why?

Component-based architecture and functional programming have become an increasingly popular approach for building UIs. They help make apps more predictable, more testable, and more maintainable.

However, our apps don't exist in a vacuum! They need to handle state, make network requests, handle data persistence, log analytics, deal with changing time, and so on. Any non-trivial app has to handle any number of these effects. Wouldn't it be nice to cleanly separate them from our apps?

Refract solves this problem for you, by harnessing the power of reactive programming. For an in-depth introduction, head to Why Refract.

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:

React Inferno Preact Redux
Callbag refract-callbag refract-inferno-callbag refract-preact-callbag refract-redux-callbag
Most refract-most refract-inferno-most refract-preact-most refract-redux-most
RxJS refract-rxjs refract-inferno-rxjs refract-preact-rxjs refract-redux-rxjs
xstream refract-xstream refract-inferno-xstream refract-preact-xstream refract-redux-xstream

To use the latest stable version, simply npm install the package you want to use:

npm install --save refract-rxjs

The Gist

The example below uses refract-rxjs to send data to localstorage.

Every time the username prop changes, its new value is sent into the stream. The stream debounces the input for two seconds, then maps it into an object (with a type of localstorage) under the key value. Each time an effect with the correct type is emitted from this pipeline, the handler calls localstorage.setItem with the effect's name and value properties.

const aperture = component => {
    return component.observe('username').pipe(
        debounce(2000),
        map(username => ({
            type: 'localstorage',
            name: 'username',
            value: username
        }))
    )
}

const handler = initialProps => effect => {
    switch (effect.type) {
        case 'localstorage':
            localstorage.setItem(effect.name, effect.value)
            return
    }
}

const WrappedComponent = withEffects(aperture, { handler })(BaseComponent)

The example demonstrates uses the two building blocks used with Refract - an aperture and a handler - and shows how they can be integrated into a React component via the withEffects higher-order component.

Aperture

An aperture controls the streams of data entering Refract. It is a function which observes data sources within your app, passes this data through any necessary logic flows, and outputs a stream of effect values in response.

Handler

A handler is a function which causes side-effects in response to effect values.

Learn Refract

Documentation

Documentation is available at refract.js.org. We aim to provide a helpful and thorough documentation: all documentation files are located on this repo and we welcome any pull request helping us achieve that goal.

Examples

We maintain and will grow over time a set of examples to illustrate the potential of Refract, as well as providing reactive programming examples: refract.js.org/examples.

Examples are illustrative and not the idiomatic way to use Refract. Each example is available for the four reactive libraries we support (RxJS, xstream, Most and Callbag), and we provide links to run the code live on codesandbox.io. All examples are hosted on this repo, and we welcome pull requests helping us maintaining them.

Contributing

Guidelines

We welcome many forms of contribution from anyone who wishes to get involved.

Before getting started, please read through our contributing guidelines and code of conduct.

Links

Logo

The Refract logo is available in the Logo directory.

License

Refract is available under the MIT license.

Discuss

Everyone is welcome to join our discussion channel - #refract on the Reactiflux Discord server.

Talks

Articles

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].