-
Hello, I am wondering how to share signals between several windows. I was considering the usage of global signals, but although they are callable from everywhere, there references are dependent on their surrounding virtual DOM. In that way, they don't share the same reference between two windows. Are there any other ways to do that with the structures that Dioxus provides? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
By studying the documentation, I found out that I can provide root context to a virtual DOM. Considering that I have a created Signal, I can pass it on to the virtual DOM like this: let mydata: Signal<MyDataType> = use_signal(|| MyDataType::new());
let second_dom = VirtualDom::new(StartComponent).with_root_context(mydata); Inside the second dom, I can than access the signal with let mydata: Signal<MyDataType> = use_context(); |
Beta Was this translation helpful? Give feedback.
By studying the documentation, I found out that I can provide root context to a virtual DOM. Considering that I have a created Signal, I can pass it on to the virtual DOM like this:
Inside the second dom, I can than access the signal with
use_context
(and the correlating type):