rxprop

1.0.2 • Public • Published

React-RxJS connector/bridge RxProp

Simply connect RxJs Subject and BehaviorSubject to your react component.

Install project:

npm install rxprop --save

Use it as a higher order component or decorator ( if you have setup ):

import React from 'react';
import { BehaviorSubject } from 'rxjs';
import rxProp from 'rxprop';

export const Store = {
  currentUser: new BehaviorSubject(null)
}

class Hello extends React.Component {
  render() {
    return `Hello, ${this.props.user}`;
  }
}
export default rxProp({user: Store.currentUser})(Hello);

You can use this library as a simple store, a replacement for redux if you want.

Read more on React & RxJS

https://pixelplux.com/en/39/react-rxjs-store-you-dont-need-redux/

Readme

Keywords

none

Package Sidebar

Install

npm i rxprop

Weekly Downloads

4

Version

1.0.2

License

ISC

Unpacked Size

3.89 kB

Total Files

6

Last publish

Collaborators

  • connexion