Skip to content

Instantly share code, notes, and snippets.

@terry90
Created September 4, 2019 10:19
Show Gist options
  • Save terry90/acdccf0ba3188f17e2c01711c98233cf to your computer and use it in GitHub Desktop.
Save terry90/acdccf0ba3188f17e2c01711c98233cf to your computer and use it in GitHub Desktop.
app.rs - yew
use log::info;
use yew::{html, Component, ComponentLink, Html, Renderable, ShouldRender};
use crate::app::modules::Header;
use crate::app::root::Model as Root;
pub struct Model {}
impl Component for Model {
type Message = ();
type Properties = ();
fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
info!("App component created");
Model {}
}
fn update(&mut self, _: Self::Message) -> ShouldRender {
true
}
}
impl Renderable<Model> for Model {
fn view(&self) -> Html<Self> {
html! {
<>
<div class="app">
<div class="title">{ "Project" }</div>
<Header />
<Root />
</div>
</>
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment