Props
Name | Type | Default | Description |
---|---|---|---|
* | * | * | Accepts any props and will pipe them through the stream |
import { Stream } from 'flowr';
Stream
is a really handy render prop component that allows you to work with props streams. The render callback takes a single argument (the props stream) and should return a stream of "renders".
The props stream is a simple Observable
with only a map
operator. You can convert it into a more powerful implementation by just "lifting" it into the type of your favourite library.
Below is a simple implementation of a counter that starts from 0 and ticks every 1000ms, using rxjs v5 (mind the imports)
import { from } from 'rxjs/observable/from'
import { interval } from 'rxjs/observable/interval'
{
props$ =>
from(props$)
.switchMap(
props =>
interval(props.time)
.map(count => {props.start + count})
)
}
{ /* ----------0---------1---------2---------3... */}
Name | Type | Default | Description |
---|---|---|---|
* | * | * | Accepts any props and will pipe them through the stream |
Contribute on Github! Edit this section.