How do I create an component without having all the callbacks bubble up to the top? #1654
Unanswered
koenichiwa
asked this question in
Q&A
Replies: 1 comment
-
You could provide the app state to all children through the context API: https://dioxuslabs.com/learn/0.4/reference/context#using-shared-state and then move the callbacks in the the component that use them (or into a separate function if you use them in multiple places). Passing around your existing hooks into children would also work, but then you need to manually pass the state in the props that you need them in. It also looks like you might be building something like a router with the ActiveScreen enum, you could use the dioxus-router instead. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to grasp Dioxus. I have some prior knowledge of Vue, but I used to stay away from GUI's. Please bear with me :)
I'm making a Todo app, and it was working fine. I had made an create/edit form, and then I wanted to move on to a new screen. But I noticed that I need to bubble up all my callbacks to the place where I defined the task collection first. Is there a way around this? If I have to define every function in my App component, then it will become really convoluted. I feel that I shouldn't share the
&mut
reference with the other components, right?What should I do?
Example code:
Beta Was this translation helpful? Give feedback.
All reactions