pub fn use_cycle_list<T, L>(
list: L,
) -> UseCycleListReturn<T, impl Fn(usize) -> T + Clone, impl Fn() + Clone, impl Fn() + Clone, impl Fn(i64) -> T + Clone>
Expand description
Cycle through a list of items.
§Demo
§Usage
use leptos_use::{use_cycle_list, UseCycleListReturn};
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"