@ormojo/react-observe
v1.0.1
Published
React components for monitoring observables.
Downloads
3
Readme
@ormojo/react-observe
React components that re-render in response to Observables emitting values.
Components
Props:
source
- an ES7 Observablechildren
- a render prop whose first parameter will be the most recent emitted value.pure
- Boolean, if true, renders only when thesource
changes or emits a value. Don't usepure
if your render prop is a function of props from the enclosing scope!
<Observe source={myObservable}>{(value) ->
<div>{value}</div>
}</Observe>
Props:
children
- a render prop whose first parameter will be the most recent emitted value.pure
- Boolean, if true, renders only when thesource
changes or emits a value. Don't usepure
if your render prop is a function of props from the enclosing scope!All other props are expected to be ES7 Observables, which will be mapped in a key-value fashion using
combineLatest
and the latest values will be passed to the render prop.
<ObserveMany val1={observable1} val2={observable2}>{({val1, val2}) ->
<div>{val1} {val2}</div>
}</Observe>