In our use of React and Bacon it's been a common use case to add handlers to some external stream (e.g. a Bacon.Bus passed to the component in props). These handlers must be unsubscribed when the component unmounts, which would typically result in tedious code like this:
This pull request adds method onValue() to BaconMixin that can be used to add handlers that will automatically be unsubscribed when the component unmounts, allowing the previous example to be rewritten as:
In our use of React and Bacon it's been a common use case to add handlers to some external stream (e.g. a
Bacon.Bus
passed to the component in props). These handlers must be unsubscribed when the component unmounts, which would typically result in tedious code like this:This pull request adds method
onValue()
toBaconMixin
that can be used to add handlers that will automatically be unsubscribed when the component unmounts, allowing the previous example to be rewritten as: