rxjs-react-component/README.md at master · christianalfoni/rxjs-react-component · GitHub

  • A component allowing you to change state using observables
  • import React from ‘ react ‘ ; import ObservableComponent from ‘ rxjs-react-component ‘ ; import { Observable } from ‘ rxjs ‘ ; class MyComponent extends ObservableComponent { constructor ( props ) { super (props); this .
  • merge ( increase$, delayedIncrease$ ); } render () { return ( < div > < h1 > Hello world ({ this .
  • You can create complex state changes by merging multiple observables.
  • onClick$ } > Increase < / button > < / div > ); } }

rxjs-react-component – A component allowing you to change state using observables

@ReactiveX: We love the usage of Finnish notation ala @andrestaltz especially with @reactjs and setting state with Observables

We recommend upgrading to the latest Safari, Google Chrome, or Firefox.

A component allowing you to change state using observables

npm install rxjs-react-component

Depends on React and rxjs

By convention all methods defined with a

at the end will expose an observable instead. If you return the observable it is expected to map to an object. This object will be run with

and cause a render on the component.

import React from ‘react’; import ObservableComponent from ‘rxjs-react-component’; class MyComponent extends ObservableComponent { constructor(props) { super(props); this.state = {count: 0}; } onClick$(observable) { return observable.map(() => ({count: this.state.count + 1})); } render() { return (

Hello world ({this.state.count})< /h1>

rxjs-react-component/README.md at master · christianalfoni/rxjs-react-component · GitHub