use_init_radio_station

Function use_init_radio_station 

Source
pub fn use_init_radio_station<Value, Channel>(
    init_value: impl FnOnce() -> Value,
) -> RadioStation<Value, Channel>
where Channel: RadioChannel<Value>, Value: 'static,
Expand description

Initialize a new radio station in the current component tree. This provides the global state to all descendant components.

Returns the RadioStation instance for direct access if needed.

§Example


fn app() -> impl IntoElement {
    use_init_radio_station::<AppState, AppChannel>(AppState::default);

    rect().child(MyComponent {})
}