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
using useCastChannel more than once doesn't work #316
Comments
Hmm I might need to change how the channels are registered... for now you might be able to solve it by only using the hook in a parent component and passing the channel as a prop to where you need it. |
I need to keep pushing to same screen(with different result) which registers channel, hence passing props won't work unfortunately. |
Hello, any chance to fix this bug? Thank |
After thinking about this a bit more, it can't be easily changed how it works without changing the API. Since If you're not able to lift the state up to a parent component, you can use the CastChannel directly (without the hook), and manage the channel yourself. In fact, managing the Cast state in a global store like Redux, Mobx or another out-of-tree state library would be a better approach anyway. For simplicity, this library provides hooks that store the state in the component tree, however, due to the nature of different in- and out-of-tree lifecycles, it doesn't work perfectly. I'll mark it as won't fix and add a warning to the docs about the limitation. |
Hi,
If I try to cast from different screens then it stops working. Any solution for this?
The text was updated successfully, but these errors were encountered: