use_timeout_fn
Wrapper for setTimeout with controls.
Demo
Usage
use leptos::prelude::*;
use leptos_use::{use_timeout_fn, UseTimeoutFnReturn};
#[component]
fn Demo() -> impl IntoView {
let UseTimeoutFnReturn { start, stop, is_pending, .. } = use_timeout_fn(
    |i: i32| {
        // do sth
    },
    3000.0
);
start(3);
view! { }
}SendWrapped Return
The returned closures start and stop are sendwrapped functions. They can
only be called from the same thread that called use_timeout_fn.
Server-Side Rendering
Make sure you follow the instructions in Server-Side Rendering.
On the server the callback will never be run. The returned functions are all no-ops and
is_pending will always be false.
Feature
This function is only available if the crate feature
use_timeout_fnis enabled