0.1.6 • Published 6 years ago

rrxjs v0.1.6

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

Reactive React Extensions for JavaScript

Build Status Coverage Status

This library provides a simple wrapper to use RxJS in your React applications. It maps observables to their current values. It manages all necessary subscriptions automatically.

$ npm install rrxjs

If you don't use a package manager you can include this script:

<script crossorigin src="https://unpkg.com/rrxjs@0.1/lib/index.umd.js"></script>
<script crossorigin src="https://unpkg.com/rrxjs@0.1/lib/index.umd.min.js"></script>

Usage

import React from 'react';
import rrxjs from 'rrxjs';
import { Subject } from 'rxjs/Subject';

// 1. Define your component like any other
let MyComponent = (props) => (
  <span>{ props.myObservable }</span>
);

// 2. Wrap it in the rrxjs function
MyComponent = rrxjs(MyComponent);

// 3. Provide an observable as prop from the parent component. Note that the
// dollar sign has been removed from the prop name of the child component

const MyParentComponent = () => (
  <div>
    <MyComponent myObservable$={new Subject()} />
  </div>
);

For more examples check out the unit tests.

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago