React Observable Subscribe 2
Inspired by Jay Phelps' React Observable Subscribe, this library exposes a single
component - <Subscribe>
- which accepts observables as props and unwraps them to a child function which is then rendered. Handles updates
from both React and the Observable props.
Wat?
const message$ = Observableconst name$ = `Gabe` // renders <span>Welcome, Gabe</span>
Pushing a new value to name$
will update the view accordingly. Additionally, replacing the child function
will immediately invoke the new one and replace the view. The component will render a <noscript />
until all
observables have passed at least one value to the subscriber.