1.0.2 • Published 6 years ago
preact-stream-builder v1.0.2
preact-stream-builder
Inspired by flutter's StreamBuilder, a component that render something listening a Subscribable object.
Installation
npm install --save preact-stream-builderArguments
stream: A Subscribable object.builder: (snapshot: { data, state }) => VNodedata: The data received from the stream subscription or theinitialDatastate: One ofactive,done,none,values,waiting
initialData: (Optional) The data passed down to thebuilderuntil the stream emit something.
Example
import { StreamBuilder } from 'preact-stream-buidler`;
<StreamBuilder
stream={interval(5000).pipe(take(4))}
initialData={'Hello wold'}
builder={({ data, state }) => (<p>{data}, {state}</p>)}
/>License
MIT