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
Feature Request: useListener
hook
#389
Comments
The naming would more more "useOnListenableChange", like "useOnStreamChange" Otherwise LGTM. Feel free to make a PR if you want to :) |
Ok sure I will try and make a PR! Let me know if I mess up something doing so as it's only my second one :) However why not a list of listenables ? It's more convenient isn't it ? |
Folks wanting to listen to multiple listenables can use the hook multiple times or use Listenable.merge It's rare that they'll want to listen to multiple listenables at once. |
Is your feature request related to a problem? Please describe.
When using
Listenable
withuseEffect
it can be a bit cumbersome to always repeat the same boilerplate offaddListener
andremoveListener
again and again:keys.length
timesaddListener
key.addListener(...)
for each keyuseEffect
closureDescribe the solution you'd like
Add a
useListener
hook.Additional context
This would be very useful to bind values when some controller changes:
and even when it depends on multiple controllers like:
The text was updated successfully, but these errors were encountered: