1.0.2 ā€¢ Published 6 years ago

react-callbag-listener v1.0.2

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

šŸ‘‚ React Callbag Listener

NPM Downloads Build Status codecov.io


So you've seen the light and accepted Callbags as the future of reactive front-end development, but you need to update a React component every time a callbag emits a new value?

šŸ‘‚ React Callbag Listener is the answer!


Demo šŸ‘€

Edit šŸ‘‚ React Callbag Listener Demo


Installation

npm install --save react-callbag-listener

or

yarn add react-callbag-listener

How it works

You provide any number of callbags as props to šŸ‘‚ React Callbag Listener, and the render function given as children will be rendered whenever any of them changes.

import CallbagListener from 'react-callbag-listener'

...

// foo$ and bar$ are callbag sources that will emit values
<CallbagListener foo={foo$} bar={bar$}>
  {({ foo, bar }) => (
    <div>
      <div>Foo value is: {foo}</div>
      <div>Bar value is: {bar}</div>
    </div>
  )}
</CallbagListener>

That's it. There are no other options or API to document. The object given to your render prop will have the same keys as you passed as callbag props.