1
0
Fork 0
This commit is contained in:
Florian RICHER (MrDev023) 2022-03-21 19:35:53 +01:00
commit 4b7cb4ad1e
9 changed files with 1756 additions and 0 deletions

View file

@ -0,0 +1,29 @@
use yew::prelude::*;
#[derive(Properties, PartialEq)]
pub struct HelloProps {
pub name: String,
}
#[function_component]
pub fn Hello(props: &HelloProps) -> Html {
let counter = use_state(|| 0);
let onclick = {
let counter = counter.clone();
Callback::from(move |_| counter.set(*counter + 1))
};
html! {
<div>
<button {onclick}>{ "Increment value" }</button>
<p>
<b>{ "Current value: " }</b>
{ *counter }
</p>
<p>
{ props.name.clone() }
</p>
</div>
}
}