use_cycle_list
Cycle through a list of items.
Demo
Usage
use leptos::prelude::*;
use leptos::logging::log;
use leptos_use::{use_cycle_list, UseCycleListReturn};
#[component]
fn Demo() -> impl IntoView {
let UseCycleListReturn { state, next, prev, .. } = use_cycle_list(
vec!["Dog", "Cat", "Lizard", "Shark", "Whale", "Dolphin", "Octopus", "Seal"]
);
log!("{}", state.get()); // "Dog"
prev();
log!("{}", state.get()); // "Seal"
view! { }
}
Feature
This function is only available if the crate feature
use_cycle_list
is enabled