Leptos-Use Guide

use_interval

Reactive counter increases on every interval.

Demo

Usage

use leptos::prelude::*;
use leptos_use::{use_interval, UseIntervalReturn};

#[component]
fn Demo() -> impl IntoView {
let UseIntervalReturn {
    counter,
    reset,
    is_active,
    pause,
    resume
}  = use_interval( 200 );
view! { }
}

SendWrapped Return

The returned closures pause, resume and reset are sendwrapped functions. They can only be called from the same thread that called use_intersection_observer.

Server-Side Rendering

On the server this function will simply be ignored.

Feature

This function is only available if the crate feature use_interval is enabled

Types

Source

SourceDemoDocs