use yew::prelude::*; use common::CommonTicket; #[function_component] fn App() -> Html { let counter = use_state(|| 0); let onclick = { let counter = counter.clone(); move |_| { let value = *counter + 1; counter.set(value); } }; let stdnts = vec! [ Stdnt { id: 1, name: "Hamada".to_string(), email: "Hamada@Gmail.com".to_string(), gpa: 3.4 }, Stdnt { id: 2, name: "Gamal".to_string(), email: "Gamal@Gmail.com".to_string(), gpa: 4.0 }, Stdnt { id: 3, name: "Joe".to_string(), email: "joe@proton.mail".to_string(), gpa: 3.8 } ]; let stdnts_comp = stdnts.iter().map(|stdnt| html! { <>

{format!("Name: {}", stdnt.name)}

{format!("Email: {}", stdnt.email)}

{format!("GPA: {}",stdnt.gpa)}


}).collect::(); html! {

{ *counter }

{ "Students:" }

{ stdnts_comp }

} } struct Stdnt { id: usize, name: String, gpa: f32, email: String, } fn main() { yew::Renderer::::new().render(); }