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/