Leptos-Use Guide

use_timestamp

Reactive current timestamp.

Demo

Usage

use leptos::*;
use leptos_use::use_timestamp;

#[component]
fn Demo() -> impl IntoView {
let timestamp = use_timestamp();

view! { }
}

With controls:

use leptos::*;
use leptos_use::{use_timestamp_with_controls, UseTimestampReturn};

#[component]
fn Demo() -> impl IntoView {
let UseTimestampReturn {
    timestamp,
    is_active,
    pause,
    resume,
} = use_timestamp_with_controls();

view! { }
}

Server-Side Rendering

On the server this function will return a signal with the milliseconds since the Unix epoch. But the signal will never update (as there's no request_animation_frame on the server).

Types

Source

SourceDemoDocs