Skip to content

A React Component that builds itself based on the latest snapshot emitted by an Observable.

License

Notifications You must be signed in to change notification settings

simonhorlick/react-stream-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-stream-builder

A React Component that builds itself based on the latest snapshot emitted by an Observable.

Usage

Install the following npm package: https://www.npmjs.com/package/react-stream-builder

Example

See ./example for a minimal example.

        <StreamBuilder
          stream={this.props.count}
          builder={(snapshot: Snapshot<number>) => {
            // If the observable has not yet emitted any values print a message
            // indicating that we're still waiting.
            if (snapshot.state !== ConnectionState.active) {
              return "Loading...";
            }

            return `Count is now ${snapshot.data}`;
          }}
        />

About

A React Component that builds itself based on the latest snapshot emitted by an Observable.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published