flowr

  • Docs
  • Examples
Docs Menu
  • Getting started
  • Conditionals
    • Maybe
    • Either
    • Flip
    • Reverse
    • Order
    • One
    • Some
    • Constant
    • Just
    • Nothing
    • Pure
  • Schedulers
    • Await
    • Stream
    • Delay
    • Debounce
    • Throttle

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... */}

Props

NameTypeDefaultDescription
***Accepts any props and will pipe them through the stream

Contribute on Github! Edit this section.