Function freya::prelude::use_reactive

pub fn use_reactive<O, D>(
    non_reactive_data: D,
    closure: impl FnMut(<D as Dependency>::Out) -> O + 'static
) -> impl FnMut() + 'static
where D: Dependency,
Expand description

Takes some non-reactive data, and a closure and returns a closure that will subscribe to that non-reactive data as if it were reactive.

§Example

use dioxus::prelude::*;

let data = 5;

use_effect(use_reactive((&data,), |(data,)| {
    println!("Data changed: {}", data);
}));