diff options
Diffstat (limited to 'src/components/input_placeholder.rs')
| -rw-r--r-- | src/components/input_placeholder.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/components/input_placeholder.rs b/src/components/input_placeholder.rs index 92f9926..05b9509 100644 --- a/src/components/input_placeholder.rs +++ b/src/components/input_placeholder.rs @@ -1,10 +1,17 @@ +use std::sync::atomic::{AtomicU32, Ordering}; + use leptos::{ IntoView, component, html::Input, prelude::{ClassAttribute, ElementChild, GlobalAttributes, NodeRef, NodeRefAttribute}, view, }; -use uuid::Uuid; + +fn get_id() -> u32 { + static ID: AtomicU32 = AtomicU32::new(0); + + ID.fetch_add(1, Ordering::Relaxed) +} #[component] pub fn InputPlaceholder( @@ -13,7 +20,7 @@ pub fn InputPlaceholder( node_ref: NodeRef<Input>, #[prop(default = None)] initial_value: Option<String>, ) -> impl IntoView { - let id = Uuid::new_v4(); + let id = get_id(); view! { <div class="relative h-14"> |
