Created
September 4, 2019 10:19
-
-
Save terry90/acdccf0ba3188f17e2c01711c98233cf to your computer and use it in GitHub Desktop.
app.rs - yew
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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