Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RxJs observables #19

Closed
streamich opened this issue Oct 28, 2018 · 3 comments · Fixed by #20
Closed

RxJs observables #19

streamich opened this issue Oct 28, 2018 · 3 comments · Fixed by #20
Labels

Comments

@streamich
Copy link
Owner

Create useObservable that tracks state of an Observable as shown here:

function useSubscribe(observable$) {
  const [value, update] = useState();
  
  useLayoutEffect(() => {
    const s = observable$.subscribe(update)
    return () => s.unsubscribe();
  }, [observable$]);
  
  return value;
}
@streamich
Copy link
Owner Author

🎉 This issue has been resolved in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@DiogoDoreto
Copy link

Nice to see that my little experiment made its way to this library :)

@streamich
Copy link
Owner Author

Thanks for sharing your experiment, hope you don't mind it landed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants