Leptos-Use Guide

use_geolocation

Reactive Geolocation API.

It allows the user to provide their location to web applications if they so desire. For privacy reasons, the user is asked for permission to report location information.

Demo

Usage

use leptos::prelude::*;
use leptos_use::{use_geolocation, UseGeolocationReturn};

#[component]
fn Demo() -> impl IntoView {
let UseGeolocationReturn {
    coords,
    located_at,
    error,
    resume,
    pause,
} = use_geolocation();

view! { }
}

SendWrapped Return

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

Server-Side Rendering

On the server all signals returns will always contain None and the functions do nothing.

Feature

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

Types

Source

SourceDemoDocs