Add frondend project
This commit is contained in:
24
frontend/src/main.rs
Normal file
24
frontend/src/main.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
use yew::prelude::*;
|
||||
|
||||
#[component]
|
||||
fn App() -> Html {
|
||||
let counter = use_state(|| 0);
|
||||
let onclick = {
|
||||
let counter = counter.clone();
|
||||
move |_| {
|
||||
let value = *counter + 1;
|
||||
counter.set(value);
|
||||
}
|
||||
};
|
||||
|
||||
html! {
|
||||
<div>
|
||||
<button {onclick}>{ "+1" }</button>
|
||||
<p>{ *counter }</p>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
yew::Renderer::<App>::new().render();
|
||||
}
|
||||
Reference in New Issue
Block a user